I have a 67*1 matrix of 1's and 0. I want that if variable = 1, it should display 'good' else 'nothing'.
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Adhish Aggarwal
le 16 Avr 2017
Réponse apportée : Image Analyst
le 16 Avr 2017
a = 1 0 0 0 0 0 0 1 0 and so on.
0 commentaires
Réponse acceptée
Image Analyst
le 16 Avr 2017
Try this:
for k = 1 : length(a)
if a(k) == 1
fprintf('a(%d) = good\n', k);
else
fprintf('a(%d) = nothing\n', k);
end
end
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Dynamic System Models 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!