open multiple pictures from a list with for loops

2 ビュー (過去 30 日間)
Tim Dreßler
Tim Dreßler 2023 年 1 月 4 日
編集済み: Voss 2023 年 1 月 4 日
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
Voss
Voss 2023 年 1 月 4 日
編集済み: Voss 2023 年 1 月 4 日
You're welcome!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by