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