How to reassign the label?

1 Ansicht (letzte 30 Tage)
Tan Wen Kun
Tan Wen Kun am 7 Dez. 2015
Kommentiert: Walter Roberson am 7 Dez. 2015
I got a table which show
table =
label 1 2 3 4 5 6 7 8 9
value 1 2 2 2 5 6 7 5 5
matrix =
1 1 1 1 1 1 1 1
1 2 2 1 3 1 4 1
1 1 1 1 3 1 4 1
1 5 5 1 1 1 1 1
1 1 1 1 6 6 6 1
1 7 7 1 1 1 1 1
1 1 1 1 8 1 9 1
1 1 1 1 1 1 1 1
I want to loop the matrix and reassign the label follow the value of table
final outcome =
1 1 1 1 1 1 1 1
1 2 2 1 2 1 2 1
1 1 1 1 2 1 2 1
1 5 5 1 1 1 1 1
1 1 1 1 6 6 6 1
1 7 7 1 1 1 1 1
1 1 1 1 5 1 5 1
1 1 1 1 1 1 1 1

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 7 Dez. 2015
final_outcome = value(matrix);
No loop needed.
  2 Kommentare
Tan Wen Kun
Tan Wen Kun am 7 Dez. 2015
after get final_outcome, I want change to 3D matrix like
final_outcome =(:,:,1)
final_outcome =(:,:,2)
final_outcome =(:,:,3)
then I want to assign each label to a unique color like label 1 equal to black color(0,0,0)
label 2=white color(255,255,255)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by