Get data from a matrix

4 Ansichten (letzte 30 Tage)
Tian Lin
Tian Lin am 22 Mär. 2011
I have a matrix such as x0=[3.88,3.88,3.88,3.88,3.88,3.88,3.59,3.59,3.59,3.59,3.59,3.23,3.59,3.59,3.23,3.23,3.23,2.94,2.94,2.94,2.94,2.94,2.94,2.59,2.59,2.59,2.59,2.59,2.59,2.59,2.59,2.26,2.26,1.97,2.26,2.26,1.97,2.26,2.26,2.26,1.97,1.97,1.97,1.97,1.62,1.62,1.97,2.88,8.41,8.73,9.70,10.03,10.35,10.03,10.03,10.35,10.35,10.35,5.50,5.17,4.85,]; Qustion 1: How can I get data from x0 to determine whether this data are duplication and increasing? Qustion 2: n=length(x0); x1=x0(1:2:n); x2=x0(2:2:n); x3=x0(1:3:n); x4=x0(2:3:n); x5=x0(3:3:n); x6=x0(1:4:n); x7=x0(2:4:n); x8=x0(3:4:n); x9=x0(4:4:n); How to write a loop as "for...end" to get x1,x2,...

Akzeptierte Antwort

Paulo Silva
Paulo Silva am 22 Mär. 2011
if numel(x0)~=unique(x0)
disp('x0 got duplicated elements')
end
if all(diff(x0)>0)
disp('x0 is increasing')
end
  4 Kommentare
Paulo Silva
Paulo Silva am 22 Mär. 2011
x={x0(1:5),x0(5:10)}
Tian Lin
Tian Lin am 22 Mär. 2011
thank you very much

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by