Group a Array Elements
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hamidreza Rafat
am 4 Apr. 2018
Beantwortet: KSSV
am 4 Apr. 2018
X=[1 2 3 3 3 1]
index 1 -> 1 index 2 -> 2 index 3 -> 3 index 4 -> 3 index 5 -> 5 index 6 -> 1
y=[{1,6},{2},{3,4,5}]
How create matrix y?
0 Kommentare
Akzeptierte Antwort
KSSV
am 4 Apr. 2018
X=[1 2 3 3 3 1] ;
[c,ia,ib] = unique(X) ;
iwant = cell(length(c),1) ;
for i = 1:length(c)
iwant{i} = find(ib==i) ;
iwant{i}
end
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu String Parsing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!