Trevor Dubois
unread,Mar 1, 2015, 10:43:43 AM3/1/15You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi,
I have spent days trying to debug code which I have written and I cannot seem to figure it out. I'm wondering if you guys have any ideas (the coding is done with Psychtoolbox). The problem line and full code is below for reference. I have tried to make so many changes and this leads to program to get stuck. Now the program asks for demographic information and then exits the Psychtoolbox window with an error.
Thanks for the help
Victor
Problem line:
Screen(w, 'The information will now be flipped'); % the information will now be displayed on the screen
Code:
clc;
clear all;
close all;
%
% Screen('Preference', 'SuppressAllWarnings', 1); %Suppresses warning that can come up
% Screen('Preference', 'SkipSyncTests', 1); %This avoids the syncing test which might lead to crashes when
%developing program
%PP_num=input('Please write down your participant number'); %get the number of the participant
ListenChar(2);
TxtSize=25;
[w, ScreenRect,Width,Height] = SetupToolBox(1/2,0,128);
%the colour will be grey and this command starts up PTB
%monitor will be on default screen mode shown by the 0
%the screen size will be either full of part of the full screen size
%determined by the 1/2 numbers
Screen('TextFont',w, 'Times New Roman'); %Chooses Times New Roman Font
Screen('TextStyle', w, 2); %Chooses bold text which is represented by 3
Screen('TextSize',w, TxtSize);
%Collect demographic data from participants using psychtoolbox
P_data{1} = str2num(GetEchoString(w, 'Please write down your participant number', 10,0, [0 191 255], [128 128 128]));
P_data{2} = GetEchoString(w, 'Please write down your name', 10, 2*TxtSize, [0 191 255], [128 128 128]);
P_data{3} = str2num(GetEchoString(w, 'Please write down your age', 10, 4*TxtSize, [0 191 255], [128 128 128]));
P_data{4} = GetEchoString(w, 'Please write down whether your gender is M/F', 10, 6*TxtSize, [0 191 255], [128 128 128]);
% Record_Responses(PP_num,PP_name,age,gender); %this will record responses into Excel
%information telling participant to continue
DrawFormattedText(w, 'Please press the spacebar in order to continue on to the next page', 'center', round(Height*0.9), [0 0 225]);
Screen(w, 'The information will now be flipped'); % the information will now be displayed on the screen
[KeyIsDown, ~, KeyCode] = KbCheck; %this does a KbCheck to make sure no keys etc are pressed down
while -strcmp(KbName(KeyCode), 'space') %Force spacebar press
[KeyIsDown, ~, KeyCode] = KbCheck;
end
KbReleaseWait; %waits until all keys are released
WaitSecs(1);