help me loop i cant understand it

14 ビュー (過去 30 日間)
George Georgy
George Georgy 2018 年 3 月 30 日
回答済み: M 2018 年 3 月 30 日
for q1 = [1 2 -1;3 0 2] for q2 = [2 1] a = q2*q1; fprintf('the sum of a =%4.2f\n',sum(a)) end end

回答 (1 件)

M
M 2018 年 3 月 30 日
Try this to see if it is gets clear to you:
for q1 = [1 2 -1;3 0 2]
for q2 = [2 1]
a = q2*q1;
fprintf('the sum of (%d %d) and %d is a =%4.2f\n',q1,q2,sum(a))
end
end

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by