Get data from a matrix
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Paulo Silva
le 22 Mar 2011
if numel(x0)~=unique(x0)
disp('x0 got duplicated elements')
end
if all(diff(x0)>0)
disp('x0 is increasing')
end
4 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Solver Outputs and Iterative Display dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!