フィルターのクリア

Print matrices whose name is based on loop values

1 回表示 (過去 30 日間)
Paras Choudhary
Paras Choudhary 2022 年 7 月 21 日
回答済み: Steven Lord 2022 年 7 月 21 日
for i = 1:3
eval(['k' num2str(i) '=i']);
end
%% Doubt - How to print k1, k2, k3 based on iteration no. ???

採用された回答

Steven Lord
Steven Lord 2022 年 7 月 21 日
Can you dynamically create variables with numbered names like k1, k2, k3, etc.? Yes.
Should you do this? The general consensus is no. That Answers post explains why this is generally discouraged and offers several alternative approaches.

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by