Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
How to group data in a tab
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello guys !
I've a problem with a tab. As you can see in the pictures, the tab has 2 columns. Column 1 = class of disease. Column 2 = Numbers of node.
Obviously one node is associated to one class of disease... for example the node 1 is a "Metabolic" disease..
My intention is to group all the nodes that belong to the same kind of disease, and then says to Matlab that, for example, all the nodes in the graph, groupped as "Bone" disease, will be coloured of Green... and so on...
Can you help me? Is there a smart way for do this for example with a loop?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/156939/image.png)
0 Kommentare
Antworten (1)
jupiter
am 7 Okt. 2016
Bearbeitet: jupiter
am 7 Okt. 2016
You can try this :
First, get the unique values of first column in a separate array using unique() function and define a number for each disease. With this you form a kind of 'rule' for each entry. Then run a loop on the main array and assign the numbers using the unique array.You can put this number in the third column of the main array. Then by sorting it according to the third column, you get continuous rows for the same disease, which in turn should group your node values as well.
0 Kommentare
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!