New variables in a loop
1 回表示 (過去 30 日間)
古いコメントを表示
Hello everyone! I'm facing some issues while trying to create new variables inside a loop. Can I load my data using a for loop while keeping first character (m)?
Thanks in advance!
0 件のコメント
回答 (1 件)
KALYAN ACHARJYA
2019 年 12 月 25 日
編集済み: KALYAN ACHARJYA
2019 年 12 月 25 日
Considering the array or cell array is best way rather than assigning new variable in each iteration.
Fs=zeros(1,35);
for i=1:35
Fs(i)=L(i)/tmax(i); % assuming L and tmax both are scalars
end
% Assuming L and tmax both are scalars, if not then
Fs=cell(1,35);
for i=1:35
Fs{i}=L(i)/tmax(i);
end
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!