# code crash

**URL:** <https://psychtoolbox.discourse.group/t/code-crash/1604>\
**Category:** Uncategorized\
**Created:** [March 27, 2006, 5:19pm UTC](https://psychtoolbox.discourse.group/t/code-crash/1604 "2006-03-27T17:19:44Z")\
**Posts on this page:** 1\
**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:** [March 27, 2006, 5:19pm UTC](https://psychtoolbox.discourse.group/t/code-crash/1604/1 "2006-03-27T17:19:44Z")

</div>

hello,  
  
i am presenting a succession of gif images and Matlab crashes (freezes) after 144   
iterations (+-1). Also the presentation time (set to 500 ms) is not respected, some images   
being presented longer and vith variable times.Here's the code:  
  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
maximg=204;  
  
 for(ii=1:4\*maximg)  
 if mod(ii,204)==0  
 fprintf('\nPAUSE....PAUSE....PAUSE\n');  
 temppic = imread('abstractgaze/fixation.jpg');  
 stimtext=Screen('MakeTexture', window,temppic);  
 Screen('DrawTexture', window, stimtext);  
 Screen(window,'Flip');  
 ExpControl('waitspace');  
 end  
 if mod(ii,2) == 0  
 temppic = imread('abstractgaze/fixation3.jpg');  
 gaga=0.5;  
 else  
 if mod(ii,4)==1  
 temppic = imread(strcat('abstractgaze/', char(stim1((ii+3)/4)) ,'.jpg'));  
 gaga=0.6+rand/2;  
 tria=(ii+3)/4  
 img=strcat('abstractgaze/', char(stim1((ii+3)/4)) ,'.jpg')  
 else   
 if mod(ii,4)==3  
 temppic = imread(strcat('abstractgaze/', char(stim2((ii+1)/4)) ,'.jpg'));  
 gaga=0.6+rand/2;  
 img=strcat('abstractgaze/', char(stim2((ii+1)/4)) ,'.jpg')  
 end  
 end  
 end  
  
stimtext=Screen('MakeTexture', window,temppic);  
priorityLevel=MaxPriority(window);  
Screen('DrawTexture', window, stimtext);   
[aa bb cc dd ee]=Screen(window,'Flip',aa+gaga);
