I am doing a matrix analysis and for this I need to create several matrices, I use a for loop but now I need to extract N arrays from the loop out of the loop. could you tell me how that could be done
for i = 1 : 1 : 2
x = input('enter value: ');
a= x*[1,2,3;4,5,6;7,8,9]
end
% I want ''a'' when i=2
d = a

回答 (1 件)

Jan
Jan 2021 年 11 月 21 日

1 投票

The question is not really clear to me. With some guessing:
a = cell(1, 2); % Pre-allocate
for i = 1:2
x = input('enter value: ');
a{i} = x * [1,2,3; 4,5,6; 7,8,9];
end
a{1}
a{2}

1 件のコメント

Mario_Duran0618
Mario_Duran0618 2021 年 11 月 21 日
Thank you very much, that is exactly what I was looking for

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

カテゴリ

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

タグ

質問済み:

2021 年 11 月 21 日

コメント済み:

2021 年 11 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by