vector repetition number counting
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,I have this vector,x=[2 4 4 1 1].I want the result to be:
1 4
2 1
4 2
4 3
1 5
I tried this small program but it skips the last row in the desired result.Could you find the mistake
d=[];
>> for i=1:4
for j=i+1:5
c=[];
if w(j)== w(i)
c=[c w(j) j];
else
c=[c w(i) i];
end
d=[d;c];
end
end
b=unique(d,'rows')
4 commentaires
Azzi Abdelmalek
le 7 Avr 2014
Ok, then what is the result for your example, I'm not asking what the result is explaining, just post the result.
Réponses (1)
yousef Yousef
le 6 Avr 2014
2 commentaires
Azzi Abdelmalek
le 6 Avr 2014
Modifié(e) : Azzi Abdelmalek
le 6 Avr 2014
Yousef don't use an answer section to add a comment. Just click on comment on this answer
Voir également
Catégories
En savoir plus sur Logical 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!