Arrange data using loop in MATLAB -
if have:
t=(1:1:5)' time=1:3:100
how arrange data t in each column starting 1 until end, interval of 3. means data t (1 5) @ column 1,4,7 , on.
i've tried:
t=[1:1:5]; nt=length(temp); time=[1:1:100]; nti=length(time); x=zeros(nt,nti); temp=temp'; initiator=2; monomer=3; post=1:3:100; l=1:post step=1; maxstep=100; while (step<maxstep) step=step+3; temp=(1:1:5)'; end t(:,l)=t; x=[t]; end
this shows result x temp @ column 1. not know how to arrange data @ columns want.
hope me. thank in advance.
how many dimensions data have? if have "temp" (temperature?) , "time" first 2 dimensions , want "t" third dimension, create three-dimension matrix.
to extract indexes [1 4 7 10 13 16 ... ], use (1:3:end)
extract indexed [2 5 8 11 14 17 ... ], use (2:3:end)
in matlab's colon notation, first value start. second value increment. third value end value , inclusive.
Comments
Post a Comment