I have a 67*1 matrix of 1's and 0. I want that if variable = 1, it should display 'good' else 'nothing'.

4 ビュー (過去 30 日間)
a = 1 0 0 0 0 0 0 1 0 and so on.

採用された回答

Image Analyst
Image Analyst 2017 年 4 月 16 日
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 件)

カテゴリ

Help Center および File ExchangeDynamic System Models についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by