open multiple pictures from a list with for loops
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I have the following problem:
I have a huge pool of pictures of which every participant in an experiment saw a portion of. Every participant has it's indiviual StimulusList in which all pictures are listed which they saw.
My goal is to enter the StimulusList of one participant and to see all the pictures he/her saw. I don't care if they open in separate windows or if I click through them (like in a gallery) (altough I'd prefer the latter version).
I have coded the following: The code works (no errors) but it only opens one picture.
All files (StimulusLists and Pics) are stored in the same WD.
clc
clear
load VP_001_StimulusList.mat; %enter StimulusList here
StimulusList = struct2table(StimulusList);
StimulusList.num = num2str(StimulusList.num, '%03d'); %add leading zeros (in the StimulusList there are no leading
%zeros but in the file names of the pics there are, hence I added them)
StimulusList.pic = strcat(StimulusList.type, '_', StimulusList.num); %the filenames of the pics are always set up as
%following negative[or]neutral_XXX, the negative[or]neutral condition and
%the number are stored in different collumns of the StimulusList, hence I
%used strcat()
for i = height(StimulusList)
file = StimulusList{i,4};
file_cat = strcat(file, '.jpg');
file_cat = string(file_cat);
img = imread(file_cat);
figure, imshow(img);
end
%the loop works but it only opens one window and one picture
Thank you for your help!
and happy new year :)
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!