Screen Crashes when Psychimaging(?) is executed in Octave under Windows 7 and error message is displayed in Ubuntu 16.04

Hello there, I am new in Octave with Python experience still looking for complete tutorials from the language but at the moment I am only learning with pieces of tutorials on youtube, and learning other things through analogies with Python… I am stuck in a problem where when this code is ran to displays a purple screen with a non-stop mouse cursor rotating, and octave-gui stop working being it after that the user insert some inputs in the text fields and after choose a file in a determined folder, this code was developed by another researcher where it is already cited in my project with his name, and I am supposed to make some tests, fixes and improvements on it to run the application after. The issue in the code is at the time to open the screen as follows the implementation (these ones where I commented (%) are what already did before, and these ones below the comments are my correction) the code is large with 825 lines as follows:

prompt = {'Enter Subject Number:','Enter Subject Name:','Enter Todays Date:','Left or Right:'};
dlgtitle = 'Information Input';
%dims = [1 50];
dims = [1 50;1 50;1 50;1 50];
opts = 'on';
answer = inputdlg(prompt,dlgtitle,dims);
%waitfor(answer);
waitfor(dims);

%% TO Excel 

% Get the name of the file that the user wants to save.
%startingFolder = userpath;
startingFolder = 'C:\Users\Vtr\Downloads\Final-task-981203\Final-task-981203\Task-981203';
defaultFileName = fullfile(startingFolder, '*.xlsx');
[baseFileName, folder] = uiputfile(defaultFileName, 'Specify a filename ');
if baseFileName == 0
    % User clicked the Cancel button.
    return;
end
% Combine the folder and base file name into the full file name.
fullFileName = fullfile(folder, baseFileName);

%% LOAD text initial setting

%% Create 1st screen : (Loading and Wait)text screen

% Open an on screen window - purple screen
[window, windowRect] = PsychImaging('OpenWindow', screenNumber, [0.5 0.5 1]);
% Set up alpha-blending for smooth (anti-aliased) lines
Screen('BlendFunction', window, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA');

After that, in the first part is created a form to insert subject nº, subject name, today’s date and left or right, and after that to specify a filename. Made these two parts it appears a purple screen with the mouse’s cursor rotating non-stop and if I try to click with the mouse an error alert box “octave-gui.exe has stopped working” appears on. I already tried to run this code on my Virtualbox-VM (Ubuntu 16.04 LTS), firstly, it notifies that my screen is being tested and calibrated and after, it appears another error screen on the terminal in Ubuntu:

PTB-INFO: OS support status: Linux 4.15.0-55-generic Supported.
PTB-INFO: Type 'PsychtoolboxVersion' for more detailed version information.
PTB-INFO: Most parts of the Psychtoolbox distribution are licensed to you under terms of the MIT License, with
PTB-INFO: some restrictions. See file 'License.txt' in the Psychtoolbox root folder for the exact licensing conditions.


PTB-WARNING: FAILED to enable synchronization to vertical retrace!


PTB-WARNING: FAILED to enable synchronization to vertical retrace (System ignored setting [Req 1 != Actual 0])!

PTB-INFO: Failed to enable realtime-scheduling [Operation not permitted]!
PTB-INFO: You need to run Matlab or Octave with root-privileges, or run the script PsychLinuxConfiguration once for this to work.
PTB-INFO: See /usr/share/doc/psychtoolbox-3-common/README.Debian to make this work.
PTB-WARNING: Couldn't even collect one single valid flip interval sample! Sanity range checks failed!
PTB-WARNING: Could be a system bug or a temporary timing problem. Retrying the procedure might help if
PTB-WARNING: the latter is the culprit.

WARNING: VBL Calibration run No. 1 failed. Retrying...
PTB-INFO: Failed to enable realtime-scheduling [Operation not permitted]!
PTB-INFO: You need to run Matlab or Octave with root-privileges, or run the script PsychLinuxConfiguration once for this to work.
PTB-INFO: See /usr/share/doc/psychtoolbox-3-common/README.Debian to make this work.
PTB-WARNING: Couldn't even collect one single valid flip interval sample! Sanity range checks failed!
PTB-WARNING: Could be a system bug or a temporary timing problem. Retrying the procedure might help if
PTB-WARNING: the latter is the culprit.

WARNING: VBL Calibration run No. 2 failed. Retrying...
WARNING: Will enable VBL busy wait-workaround before trying final VBL Calibration run No. 3.
WARNING: This will hopefully work-around graphics driver bugs of the GPU sync-to-retrace mechanism. Cross your fingers!
PTB-INFO: Failed to enable realtime-scheduling [Operation not permitted]!
PTB-INFO: You need to run Matlab or Octave with root-privileges, or run the script PsychLinuxConfiguration once for this to work.
PTB-INFO: See /usr/share/doc/psychtoolbox-3-common/README.Debian to make this work.
PTB-WARNING: Couldn't even collect one single valid flip interval sample! Sanity range checks failed!
PTB-WARNING: Could be a system bug or a temporary timing problem. Retrying the procedure might help if
PTB-WARNING: the latter is the culprit.


PTB-INFO: OpenGL-Renderer is VMware, Inc. :: SVGA3D; build: RELEASE;  LLVM; :: 2.1 Mesa 18.0.5
PTB-INFO: VBL startline = 664 , VBL Endline = -1
PTB-INFO: Beamposition queries unsupported or defective on this system. Using basic timestamping as fallback.
PTB-INFO: Timestamps returned by Screen('Flip') will be therefore less robust and accurate.
PTB-INFO: Measured monitor refresh interval from VBLsync = 0.000000 ms [inf Hz]. (0 valid samples taken, stddev=10000000.000000 ms.)
PTB-INFO: Reported monitor refresh interval from operating system = 16.667222 ms [59.998001 Hz].
PTB-INFO: Small deviations between reported values are normal and no reason to worry.

WARNING: Couldn't compute a reliable estimate of monitor refresh interval! The trouble with VBL syncing?!?

WARNING: Mismatch between measured monitor refresh interval and interval reported by the operating system.
This indicates massive problems with VBL sync.


----- ! PTB - ERROR: SYNCHRONIZATION FAILURE ! -----

One or more internal checks (see Warnings above) indicate that synchronization
of Psychtoolbox to the vertical retrace (VBL) is not working on your setup.

This will seriously impair proper stimulus presentation and stimulus presentation timing!
Please read 'help SyncTrouble' for information about how to solve or work-around the problem.
You can force Psychtoolbox to continue, despite the severe problems, by adding the command
Screen('Preference', 'SkipSyncTests', 1); at the top of your script, if you really know what you are doing.

error: Screen: See error message printed above.
error: Called from
    PsychImaging at line 2240 column 26
    Naderi_test_task_v_main_1203_v_2 at line 110 column 20

I would like to know if the issue is in my computer configurations that don’t support Psychtoolbox resources or any configuration that I need to change. I have already posted this same question at stackoverflow but I didn’t receive any help that solved this problem, and when I typed PsychtoolboxVersion at the terminal it was displayed the installed version. It is being developed in Windows 7 and Ubuntu 16.04 LTS through Oracle Virtualbox VM, GNU Octave GUI/CLI 5.2.0., SlikSVN 1.12.0., 64-Bit GStreamer-1.16.0 MSVC. Thanks in advance

It fails the timing tests under Ubuntu because you are running it in a VM which can’t work - miserable timing. Normally PTB warns you about this if it detects a VM, but this new type of virtual graphics card is not yet recognized.

On Windows it probably crashes, because you use Octave 5.2, instead of the required Octave 5.1. Unfortunately at least on Windows and macOS, each PTB release can only work with one specific supported Octave version, due to limitations of Octave. A future PTB 3.0.17 will support Octave 5.2 or 6, whatever’s the most recent one at time of release.

Mario, I have tried to run the code again with Octave-5.1 (Installed from octave 5.1.0-w64-64-installer.exe link) under Windows 7 and I am still facing the same error here, firstly, conforming the code-elapse I ran the form to fill the text fields with information, after I choose a valid .xlsm file and when the PsychImaging function was executed, firstly appeared the Psychtoolbox Calibration screen and after it turned out to that lilac screen with the mouse cursor rotating non-stop, and when I pressed Esc and clicked with the left mouse button it appeared an error alert (Octave-gui.exe has stopped working) again. I am still using the Octave 5.1 with Psychtoolbox 3.0.16., the same issue repeated even changing the version to a previous one.

I also executed this Totally Minimal Demo for test purposes (http://peterscarfe.com/totallyminimaldemo.html), it is possible to see a gray screen and the same mouse cursor rotating non-stop and impossible to use the mouse, but here I can able to press the Esc button to quit this action and no error happen.

In Ubuntu I am gonna try to run with Octave 5.1 to check if it works, but I am so much stucked on it

On Ubuntu, you use whatever octave version is installed by default, and it will work. The reason for sync failure is that you run it in a VM, as i said before. A Screen(‘Preference’,‘SkipSyncTests’, 2); would allow it to work in a VM – with broken timing! – just as the error output literally tells you.

On Windows, as i just realize now while rereading your code, it behaves exactly as it should if the code you posted is really your script. Your script opens a window with purple background and then - nothing. So obviously it will show the welcome screen, then the purple background and then the script will finish and you are left staring at a purple screen and a “busy” mouse cursor.

I have finished to install as second OS (Ubuntu 18.04) through dual boot with Windows 7 that is the OS that I already have. I don’t know why when I run this code in Ubuntu it appears the message: Please read http://www.octave.org/missing.html to learn how you can contribute missing functionality. error: ‘clearvars’ undefined near line 7 column 1
error: called from at line 7 column 1.

When I ran it in my original OS (Windows 7) this message didn’t appear, but at my VM and here at the Ubuntu 18.04 that I finished to install in my pc. Are there any dependencies or something missing?

Octave 4.2 from Ubuntu 18.04 doesn’t yet support clearvars, so you’ll have to do without it. A simple “clear” command will most likely do the same for your purpose. I know some tutorials use clearvars at the beginning of sample code, instead of the clear command, which is well supported everywhere, not only on recent Matlab.

But as a general approach, if you only have a single display machine, add the PsychDebugWindowConfiguration; command at the top of your script during development. This will give you a half transparent window, so you can see the Octave command window output with error messages etc. so you don’t get confused if things freeze or such, because your script aborted with some error, or simply finished after showing a purple background in your case. Makes debugging easier. Then you can compare what you write against tutorials if something goes wrong.

1 Like

Mario, finally it worked here!! I didn’t know that clearvars and clear commands do the same thing, I still have created a new .m file and typed the sca;, close all; and clearvars; on it only to know if it’s necessary to have them in each PTB file.

About the PsychDebugWindowConfiguration it gave me a such nice hand at my debug here, and finally I was able to navigate better!! I was testing PTB without the PsychDebugWindowConfiguration but I have realized that if the screen appears I don’t know how I finish my program execution! Again, big thanks for the help here!!