Hi,
I have a vector of image files. I would like to pull out only a subset of these files which meet a certain condition. The file names are numbers, and are organized (i.e., files 1100-1199 are one group, 1200-1299 another, etc.). I tried to use the find function, but since these are file names and not simply numbers, I don't think that will work. Should I use "strcmp"?. I'm not familiar with it. My code I have so far is below… Thanks! I'm working with Psychtoolbox.
close all;clear all;clc % clear command window
% Images
Images = {'1100.bmp';'1202.bmp';'1203.bmp';...}% Shuffle images
Images=Shuffle(Images)% Display matched image
MatchedImages=find(Images(Images<='1399' & Images>='1300'))RandomMatchedImage = MatchedImages{ceil(rand(1)*length(MatchedImages))}
…
sca;imagedata=imread(RandomMatchedImage);win=Screen('OpenWindow',0);black=BlackIndex(win);Screen('FillRect', win, black);TexturePointer=Screen('MakeTexture',win,imagedata);clear imagedata;Screen('DrawTexture',win,TexturePointer);Screen('Flip',win);WaitSecs(10);sca;
Best Answer