Get data from a matrix
8 次查看(过去 30 天)
显示 更早的评论
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,...
0 个评论
采纳的回答
Paulo Silva
2011-3-22
if numel(x0)~=unique(x0)
disp('x0 got duplicated elements')
end
if all(diff(x0)>0)
disp('x0 is increasing')
end
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!