フィルターのクリア

How to make dynamic variable names (A1, A2, ..., An) with "for" loop?

2 ビュー (過去 30 日間)
JIkrul Sayeed
JIkrul Sayeed 2018 年 3 月 29 日
編集済み: Stephen23 2018 年 3 月 29 日
Hello community,
my knowledge of Matlab is limited, I admit it. So, I am sorry if I am going to make mistakes.
I have to create a series of variable using a "for" loop. But i can not create it !!!
for i=1:r
sprintf('A%d=[0]', i)
end
ANd i want to use those variable(A,A2,A3....) in the next for loop instead of a,b,c,d,e,
a=0; b=0;c=0;d=0;e=0;
for i=1:n
if m(i)>=1 && m(i)<=6
a=a+1;
elseif m(i)>=7 && m(i)<=12
b=b+1;
elseif m(i)>=13 && m(i)<=19
c=c+1;
elseif m(i)>=20 && m(i)<=25
d=d+1;
elseif m(i)>=26 && m(i)<=30
e=e+1;
end
end
is it possible ??
  4 件のコメント
Stephen23
Stephen23 2018 年 3 月 29 日
編集済み: Stephen23 2018 年 3 月 29 日

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

回答 (1 件)

Image Analyst
Image Analyst 2018 年 3 月 29 日

カテゴリ

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