Effacer les filtres
Effacer les filtres

How to reassign the label?

2 vues (au cours des 30 derniers jours)
Tan Wen Kun
Tan Wen Kun le 7 Déc 2015
Commenté : Walter Roberson le 7 Déc 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

Réponse acceptée

Walter Roberson
Walter Roberson le 7 Déc 2015
final_outcome = value(matrix);
No loop needed.
  2 commentaires
Tan Wen Kun
Tan Wen Kun le 7 Déc 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)
Walter Roberson
Walter Roberson le 7 Déc 2015

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by