Plot pixels from 2D boolean array
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Radhika Kulkarni
le 30 Nov 2019
Réponse apportée : Radhika Kulkarni
le 2 Déc 2019
I have a 2D boolean array stored 0s and 1s where I want to plot a red pixel. For example, If the 2D boolean array has 1 for (20, 20) location, it should plot a red pixel at that location. Else, it is has 0, it should not plot the red pixel.
Can someone help me?
Réponse acceptée
Stephan
le 30 Nov 2019
% your array
A = randi(2,101)-1;
% the result;
R=255*ones(101);
G=255*(-A+1);
B=255*(-A+1);
res = cat(3,R,G,B);
% plot result
imshow(res)
4 commentaires
Plus de réponses (2)
Radhika Kulkarni
le 30 Nov 2019
1 commentaire
Stephan
le 30 Nov 2019
On File Exchange there are also tools to create gif animations. Maybe you want to use this.
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!