How to store different results of for loop in same or different arrays, avoiding the overwriting of the results? (in MATLAB R2013b)

1 回表示 (過去 30 日間)
A=[200 250 300 250];
Len(A)=length(A);
for k=1:1:(Len(A)-1)
T1=A(k);
T2=A(k+1);
end
j=1;
for i=1:1:L
if (T1<=Temp(i))&&(Temp(i)<=T2)
array(j,1)=i;
j=j+1;
end
end
L1=length(array);
for j=1:1:L1
a=array(j);
X(j,1)=P(a);
X(j,2)=Q(a);
X(j,3)=R(a);
X(j,4)=S(a);
X(j,5)=T(a);
end

回答 (1 件)

Pritesh Shah
Pritesh Shah 2016 年 10 月 5 日
A(i), use can use,
for i=1:10
A(i)=...
end
  1 件のコメント
KANCHAN PATIL
KANCHAN PATIL 2016 年 10 月 6 日
Thank you Sir for the answer. But I want to create three array individually containing no. of rows and might be 5-8 columns. Like X1 containing Col P, Col Q, Col R, Col S, Col T, etc and same columns for X2 array and X3 array with some different values and X1,X2 and X3 have different condition. Like X1 is the array with temperature range between 200-250 deg C, X2 is the array with temperature range between 250-300 deg C and X3 is the array with temperature range between 300-350 deg C. Could you help me with this? Regards, Patil Kanchan P., MTech-II

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

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by