Unable to loop through the datastore

14 ビュー (過去 30 日間)
john
john 2022 年 2 月 3 日
回答済み: yanqi liu 2022 年 2 月 7 日
When i am tryting to do this
for k=1:5
k
I=readimage(ds,k)
imshow(I)
end
It just displays one image and not 5 images
also when i use has(ds) function same thing happens
I am unable to go through all the images so how can i do it?
output:
1
2
3
4
5
displays just one image
  1 件のコメント
Stephen23
Stephen23 2022 年 2 月 3 日
編集済み: Stephen23 2022 年 2 月 3 日
"It just displays one image and not 5 images"
Actually it displays all of the images, but because you did not not pause in between each one or display them in different axes each image will simply replace the previous one faster than a human can see. That is exactly what you wrote your code to do. You need to decide how you want to see all of those images:
  • by pausing in between,
  • by displaying them to different axes,
  • something else.
What do you want to do?

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

回答 (2 件)

KSSV
KSSV 2022 年 2 月 3 日
for k=1:5
k
I=readimage(ds.Files{k})
imshow(I)
end

yanqi liu
yanqi liu 2022 年 2 月 7 日
for k=1:5
k
I=readimage(ds,k);
figure(k);imshow(I); title(num2str(k))
end

カテゴリ

Help Center および File ExchangeImage Processing and Computer Vision についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by