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 CenterFile Exchange 中查找有关 Whos 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by