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 :)

采纳的回答

Voss
Voss 2023-1-4
for i = height(StimulusList)
should be:
for i = 1:height(StimulusList)
  6 个评论
Tim Dreßler
Tim Dreßler 2023-1-4
The pause option is already nice but I'll try to build a little GUI - Thank you so much - made my night

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品


版本

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by