# error during calibration.

**URL:** <https://psychtoolbox.discourse.group/t/error-during-calibration/900>\
**Category:** Uncategorized\
**Created:** [May 25, 2007, 4:07am UTC](https://psychtoolbox.discourse.group/t/error-during-calibration/900 "2007-05-25T04:07:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [May 25, 2007, 4:07am UTC](https://psychtoolbox.discourse.group/t/error-during-calibration/900/1 "2007-05-25T04:07:27Z")

</div>

Dear Friend  
I have a calibration program which I am trying to run on Mac OS X using Matllab version 7   
and PTB version 3.0.8 and flavor stable.A part of the code and the error message is as   
follows.  
  
setGuns = [];   
nColourGuns = 3;  
lumStep = 8; % this is the luminance increment. Can be coarse or fine. 8 works well.  
for i = 1:nColourGuns  
 lumSteps = [0:lumStep:256];  
 [m, n] = size(lumSteps);  
 lumSteps(n) = lumSteps(n) - 1;   
 newClut = CLUT;  
 for j = 1:n  
 setGuns = zeroGuns;  
 setGuns(1, i) = lumSteps(j);  
 newClut(1,:) = setGuns;  
 fprintf(1,['CLUT entry: ' int2str(setGuns) '\n']);   
 Screen(w,'LoadCLUT',newClut);  
 Screen(w, 'FillRect', setGuns);   
 SysBeep;  
 Screen(w,'DrawText','Read and enter luminance, then press keypad enter for next   
luminance level', 250, 20, [200 200 200]);  
  
 correctVal = 0;  
 while KbCheck;end; % wait until any depressed keys are released.  
  
 while correctVal ~= 1  
 lumVals(j,(i-1)\*3+1) = i;  
 lumVals(j,(i-1)\*3+2) = setGuns(i);  
 lumVals(j,(i-1)\*3+3) = str2num( Ask(w,'',[setGuns],[setGuns],'GetString') );  
 while KbCheck;end; % wait until any depressed keys are released.  
  
 % check if input value is correct  
 Screen(w,'DrawText','Entered value was:', 250, 40, [200 200 200]);  
 Screen(w,'DrawText',num2str(lumVals(j,(i-1)\*3+3)), 280, 60, [200 200 200]);  
 Screen(w,'DrawText','Is this correct?', 250, 80, [200 200 200]);  
 Screen(w,'DrawText','Hit keypad enter again to continue, or hit keypad zero to   
enter the correct luminace value', 250, 100, [200 200 200]);  
  
 [keyIsDown, secs, keyCode] = KbCheck;  
 while ~keyIsDown  
 [keyIsDown, secs, keyCode] = KbCheck;  
 end  
 keyNum = find(keyCode);  
 while KbCheck;end;   
 % check that the right keys were pressed, start again if not  
 if keyNum==88 %key number of keypay 'enter'  
 correctVal = 1;  
 elseif keyNum==98 % key number of keypay zero  
 correctVal = 0;  
 Screen(w, 'FillRect', setGuns);   
 Screen(w,'DrawText','Enter correct value, then press keypad enter', 250, 20, [200   
200 200 ]);  
 end  
 FlushEvents('keyDown');  
 end  
  
 end %for  
end %for  
  
I am getting an error message saying   
Error in ==\> GetChar at 229  
 charValue = OSX\_JAVA\_GETCHAR.getChar;  
  
Error in ==\> GetString at 23  
 char=GetChar;  
  
Error in ==\> Ask at 81  
reply=eval(replyFun);  
  
Error in ==\> measureRGBcolourGuns at 46  
 lumVals(j,(i-1)\*3+3) = str2num( Ask(w,'',[setGuns],[setGuns],'GetString') );  
  
Can anyone suggest me to fix the error. Any help would be appreciated.  
Thanks and Regards  
Rishi

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [May 31, 2007, 2:38am UTC](https://psychtoolbox.discourse.group/t/error-during-calibration/900/2 "2007-05-31T02:38:36Z")

</div>

Which OS/X version? Should work on 10.3.9 and later.  
Was this all error output or did you leave anything out?  
What does "lasterror" say?  
What does the command PsychJavaTrouble tell if you run it?  
Does the "GetCharTest" routine work correctly?  
  
-mario  
  

> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "rishi\_rustam" \<rishi\_rustam@...\> wrote:  
> \>  
> \> Dear Friend  
> \> I have a calibration program which I am trying to run on Mac OS X using Matllab version   
> 7   
> \> and PTB version 3.0.8 and flavor stable.A part of the code and the error message is as   
> \> follows.  
> \>   
> \> setGuns = [];   
> \> nColourGuns = 3;  
> \> lumStep = 8; % this is the luminance increment. Can be coarse or fine. 8 works well.  
> \> for i = 1:nColourGuns  
> \> lumSteps = [0:lumStep:256];  
> \> [m, n] = size(lumSteps);  
> \> lumSteps(n) = lumSteps(n) - 1;   
> \> newClut = CLUT;  
> \> for j = 1:n  
> \> setGuns = zeroGuns;  
> \> setGuns(1, i) = lumSteps(j);  
> \> newClut(1,:) = setGuns;  
> \> fprintf(1,['CLUT entry: ' int2str(setGuns) '\n']);   
> \> Screen(w,'LoadCLUT',newClut);  
> \> Screen(w, 'FillRect', setGuns);   
> \> SysBeep;  
> \> Screen(w,'DrawText','Read and enter luminance, then press keypad enter for next   
> \> luminance level', 250, 20, [200 200 200]);  
> \>   
> \> correctVal = 0;  
> \> while KbCheck;end; % wait until any depressed keys are released.  
> \>   
> \> while correctVal ~= 1  
> \> lumVals(j,(i-1)\*3+1) = i;  
> \> lumVals(j,(i-1)\*3+2) = setGuns(i);  
> \> lumVals(j,(i-1)\*3+3) = str2num( Ask(w,'',[setGuns],[setGuns],'GetString') );  
> \> while KbCheck;end; % wait until any depressed keys are released.  
> \>   
> \> % check if input value is correct  
> \> Screen(w,'DrawText','Entered value was:', 250, 40, [200 200 200]);  
> \> Screen(w,'DrawText',num2str(lumVals(j,(i-1)\*3+3)), 280, 60, [200 200 200]);  
> \> Screen(w,'DrawText','Is this correct?', 250, 80, [200 200 200]);  
> \> Screen(w,'DrawText','Hit keypad enter again to continue, or hit keypad zero to   
> \> enter the correct luminace value', 250, 100, [200 200 200]);  
> \>   
> \> [keyIsDown, secs, keyCode] = KbCheck;  
> \> while ~keyIsDown  
> \> [keyIsDown, secs, keyCode] = KbCheck;  
> \> end  
> \> keyNum = find(keyCode);  
> \> while KbCheck;end;   
> \> % check that the right keys were pressed, start again if not  
> \> if keyNum==88 %key number of keypay 'enter'  
> \> correctVal = 1;  
> \> elseif keyNum==98 % key number of keypay zero  
> \> correctVal = 0;  
> \> Screen(w, 'FillRect', setGuns);   
> \> Screen(w,'DrawText','Enter correct value, then press keypad enter', 250, 20,   
> [200   
> \> 200 200 ]);  
> \> end  
> \> FlushEvents('keyDown');  
> \> end  
> \>   
> \> end %for  
> \> end %for  
> \>   
> \> I am getting an error message saying   
> \> Error in ==\> GetChar at 229  
> \> charValue = OSX\_JAVA\_GETCHAR.getChar;  
> \>   
> \> Error in ==\> GetString at 23  
> \> char=GetChar;  
> \>   
> \> Error in ==\> Ask at 81  
> \> reply=eval(replyFun);  
> \>   
> \> Error in ==\> measureRGBcolourGuns at 46  
> \> lumVals(j,(i-1)\*3+3) = str2num( Ask(w,'',[setGuns],[setGuns],'GetString') );  
> \>   
> \> Can anyone suggest me to fix the error. Any help would be appreciated.  
> \> Thanks and Regards  
> \> Rishi  
> \>

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [June 4, 2007, 5:49pm UTC](https://psychtoolbox.discourse.group/t/error-during-calibration/900/3 "2007-06-04T17:49:34Z")

</div>

hmm. If PsychJavaTrouble makes GetChar working, but it doesn't work  
without it, then read "help PsychJavaTrouble" for a permanent solution.  
  
But first i'd update to the very latest PTB 'beta' release and then retest,  
maybe the problems are already fixed there. E.g., if i execute this:  
  
w=Screen('OpenWindow', 0); reply=Ask(w,'What''s your name?',[],[],'GetString'); sca; reply  
  
on the matlab command window, it simply works.  
  
In general we do advice against using 'stable' unless you have good  
reason to do so. 'stable' is always outdated by multiple months wrt.  
beta, so many problems may exist in stable that are already fixed in  
beta.  
  
I'll probably change the defaults of our downloader to download  
'beta' in the future instead of 'stable', or even drop the whole 'stable'  
branch. The reasons why it exists in the first place don't seem to be  
valid anymore and you're nearly always better off with beta.  
  
-mario  
  

> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "rishi\_rustam" \<rishi\_rustam@...\> wrote:  
> \>  
> \> Dear Mario,  
> \> I am sorry for not have checked the reply to this post of mine. I have OS/X 10.4.8  
> \> Well i had posted the complete error   
> \> When i run PsychJavaTrouble it says "Added PsychJava folder to dynamic class path.   
> \> Psychtoolbox Java commands should work now!"  
> \> GetCharTest does work perfectly.  
> \> I did like to mention one thing is that when i run my calibration program it was giving   
> me   
> \> an error saying   
> \> "??? Invalid command (error state J)  
> \>   
> \> Error in ==\> Ask at 79  
> \> Screen(window,'WindowToFront');  
> \>   
> \> Error in ==\> measureRGBcolourGuns at 46  
> \> lumVals(j,(i-1)\*3+3) = str2num( Ask(w,'',[setGuns],[setGuns],'GetString') );  
> \> "  
> \> But when i comment out the line "Screen(window,'WindowToFront');" in Ask.m it gives   
> me   
> \> the following error   
> \> "Error in ==\> GetChar at 229  
> \> charValue = OSX\_JAVA\_GETCHAR.getChar;  
> \>   
> \> Error in ==\> GetString at 23  
> \> char=GetChar;  
> \>   
> \> Error in ==\> Ask at 81  
> \> reply=eval(replyFun);  
> \>   
> \> Error in ==\> measureRGBcolourGuns at 46  
> \> lumVals(j,(i-1)\*3+3) = str2num( Ask(w,'',[setGuns],[setGuns],'GetString') );"  
> \>   
> \> I still do not understand why it is not working  
> \> Regards  
> \> Rishi  
> \> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "Mario Kleiner" \<mario.kleiner@\> wrote:  
> \> \>  
> \> \> Which OS/X version? Should work on 10.3.9 and later.  
> \> \> Was this all error output or did you leave anything out?  
> \> \> What does "lasterror" say?  
> \> \> What does the command PsychJavaTrouble tell if you run it?  
> \> \> Does the "GetCharTest" routine work correctly?  
> \> \>   
> \> \> -mario  
> \> \>   
> \> \> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "rishi\_rustam" \<rishi\_rustam@\> wrote:  
> \> \> \>  
> \> \> \> Dear Friend  
> \> \> \> I have a calibration program which I am trying to run on Mac OS X using Matllab   
> \> version   
> \> \> 7   
> \> \> \> and PTB version 3.0.8 and flavor stable.A part of the code and the error message is   
> as   
> \> \> \> follows.  
> \> \> \>   
> \> \> \> setGuns = [];   
> \> \> \> nColourGuns = 3;  
> \> \> \> lumStep = 8; % this is the luminance increment. Can be coarse or fine. 8 works well.  
> \> \> \> for i = 1:nColourGuns  
> \> \> \> lumSteps = [0:lumStep:256];  
> \> \> \> [m, n] = size(lumSteps);  
> \> \> \> lumSteps(n) = lumSteps(n) - 1;   
> \> \> \> newClut = CLUT;  
> \> \> \> for j = 1:n  
> \> \> \> setGuns = zeroGuns;  
> \> \> \> setGuns(1, i) = lumSteps(j);  
> \> \> \> newClut(1,:) = setGuns;  
> \> \> \> fprintf(1,['CLUT entry: ' int2str(setGuns) '\n']);   
> \> \> \> Screen(w,'LoadCLUT',newClut);  
> \> \> \> Screen(w, 'FillRect', setGuns);   
> \> \> \> SysBeep;  
> \> \> \> Screen(w,'DrawText','Read and enter luminance, then press keypad enter for   
> next   
> \> \> \> luminance level', 250, 20, [200 200 200]);  
> \> \> \>   
> \> \> \> correctVal = 0;  
> \> \> \> while KbCheck;end; % wait until any depressed keys are released.  
> \> \> \>   
> \> \> \> while correctVal ~= 1  
> \> \> \> lumVals(j,(i-1)\*3+1) = i;  
> \> \> \> lumVals(j,(i-1)\*3+2) = setGuns(i);  
> \> \> \> lumVals(j,(i-1)\*3+3) = str2num( Ask(w,'',[setGuns],[setGuns],'GetString') );  
> \> \> \> while KbCheck;end; % wait until any depressed keys are released.  
> \> \> \>   
> \> \> \> % check if input value is correct  
> \> \> \> Screen(w,'DrawText','Entered value was:', 250, 40, [200 200 200]);  
> \> \> \> Screen(w,'DrawText',num2str(lumVals(j,(i-1)\*3+3)), 280, 60, [200 200   
> 200 ]);  
> \> \> \> Screen(w,'DrawText','Is this correct?', 250, 80, [200 200 200]);  
> \> \> \> Screen(w,'DrawText','Hit keypad enter again to continue, or hit keypad zero   
> to   
> \> \> \> enter the correct luminace value', 250, 100, [200 200 200]);  
> \> \> \>   
> \> \> \> [keyIsDown, secs, keyCode] = KbCheck;  
> \> \> \> while ~keyIsDown  
> \> \> \> [keyIsDown, secs, keyCode] = KbCheck;  
> \> \> \> end  
> \> \> \> keyNum = find(keyCode);  
> \> \> \> while KbCheck;end;   
> \> \> \> % check that the right keys were pressed, start again if not  
> \> \> \> if keyNum==88 %key number of keypay 'enter'  
> \> \> \> correctVal = 1;  
> \> \> \> elseif keyNum==98 % key number of keypay zero  
> \> \> \> correctVal = 0;  
> \> \> \> Screen(w, 'FillRect', setGuns);   
> \> \> \> Screen(w,'DrawText','Enter correct value, then press keypad enter', 250,   
> 20,   
> \> \> [200   
> \> \> \> 200 200 ]);  
> \> \> \> end  
> \> \> \> FlushEvents('keyDown');  
> \> \> \> end  
> \> \> \>   
> \> \> \> end %for  
> \> \> \> end %for  
> \> \> \>   
> \> \> \> I am getting an error message saying   
> \> \> \> Error in ==\> GetChar at 229  
> \> \> \> charValue = OSX\_JAVA\_GETCHAR.getChar;  
> \> \> \>   
> \> \> \> Error in ==\> GetString at 23  
> \> \> \> char=GetChar;  
> \> \> \>   
> \> \> \> Error in ==\> Ask at 81  
> \> \> \> reply=eval(replyFun);  
> \> \> \>   
> \> \> \> Error in ==\> measureRGBcolourGuns at 46  
> \> \> \> lumVals(j,(i-1)\*3+3) = str2num( Ask(w,'',[setGuns],  
> [setGuns],'GetString') );  
> \> \> \>   
> \> \> \> Can anyone suggest me to fix the error. Any help would be appreciated.  
> \> \> \> Thanks and Regards  
> \> \> \> Rishi  
> \> \> \>  
> \> \>  
> \>
