how to make the output from a for loop displayed in an horizontal pattern

8 ビュー (過去 30 日間)
segun
segun 2014 年 4 月 27 日
回答済み: rifat 2014 年 4 月 27 日
I need syntax in matlab to make answer displayed as (1 by 8 ) for the case below exactly the way the for loop figures below are arranged. for f = [1 4 8 10 12 16 18 20]; b=2; c=1; d=1; n=4; z=b*c*d*n disp(z) % make z display answer as 10 ,20,30,40,50 etc end Thanks

採用された回答

rifat
rifat 2014 年 4 月 27 日
Use fprintf() instead of disp() within for loop. For example,
fprintf('%d ',z);

その他の回答 (0 件)

カテゴリ

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