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

1 view (last 30 days)
KANCHAN PATIL
KANCHAN PATIL on 5 Oct 2016
Commented: KANCHAN PATIL on 6 Oct 2016
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

Answers (1)

Pritesh Shah
Pritesh Shah on 5 Oct 2016
A(i), use can use,
for i=1:10
A(i)=...
end
  1 Comment
KANCHAN PATIL
KANCHAN PATIL on 6 Oct 2016
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

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!