Create array address using for loop

Hi
I need to use for loop for creating address in structure example
For i=1:1:5000
[A(i),B(i),C(i)]=imread('fff',(i-1));
end;
I know this program is wrong.
I want files to be created as A1=some numbers,B1=some numbers....
A2=some numbers,B2=some numbers....
A3=some numbers,B3=some numbers....
A5000=some numbers,B5000=some numbers....
to be saved in workspace.
Thank you in advance

1 件のコメント

Stephen23
Stephen23 2019 年 9 月 20 日
編集済み: Stephen23 2019 年 9 月 20 日
"I want files to be created as ... to be saved in workspace."
Files are saved on your harddrive.
Variables are what is contained in the MATLAB workspace.
"I know this program is wrong."
But using indexing is perfectly right. Indexing is simple, neat, easy to debug, and very efficient (unlike what you are trying to do).

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

 採用された回答

Stephen23
Stephen23 2019 年 9 月 20 日
編集済み: Stephen23 2019 年 9 月 20 日

0 投票

Just use cell arrays:
N = 5000;
A = cell(1,N);
B = cell(1,N);
C = cell(1,N);
for k = 1:N
[A{k},B{k},C{k}] = imread('fff',k-1);
end

その他の回答 (0 件)

カテゴリ

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

タグ

質問済み:

2019 年 9 月 20 日

コメント済み:

2019 年 9 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by