save images in array in two for loops

Hi all,
I want to save my images in arrays so that l can have access to later.
All together l have 63 images and I hope to get all images into the array b.
With my code, I can only have 7 images stored.
Can someone help? Thanks a lot.
b=cell(63,1);
for t=1:9
for i=1:7
I=imread(['calibrate2-P01.00' num2str(t) '00' num2str(i) '.tif']);
b{i}=I;
end
end

 採用された回答

VBBV
VBBV 2023 年 8 月 1 日
編集済み: VBBV 2023 年 8 月 2 日

1 投票

b=cell(7,9);
for t=1:9
for i=1:7
I= rand(34,78,2); % image data
b{i,t}=I;
end
end
b = b(:)
b = 63×1 cell array
{34×78×2 double} {34×78×2 double} {34×78×2 double} {34×78×2 double} {34×78×2 double} {34×78×2 double} {34×78×2 double} {34×78×2 double} {34×78×2 double} {34×78×2 double} {34×78×2 double} {34×78×2 double} {34×78×2 double} {34×78×2 double} {34×78×2 double} {34×78×2 double}

3 件のコメント

VBBV
VBBV 2023 年 8 月 1 日
Use both for loop indices to store image data
Yunwei
Yunwei 2023 年 8 月 2 日
Hi,
thanks for your reply. However it doesn't work when I used the code you provided.
It only saves the last iteration in b.
VBBV
VBBV 2023 年 8 月 2 日
編集済み: VBBV 2023 年 8 月 2 日
Actually if you want to have all the images as vector then you can write as
b = b(:)
Instead of
b = b{:}

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2023 年 8 月 1 日

編集済み:

2023 年 8 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by