fprint f help with printing a list
6 ビュー (過去 30 日間)
古いコメントを表示
i am trying to make a fprintf line to display like the attatched screenshot below based on the code below
function x = Xsection(type)
switch type
case 1 % Benchmark
x = [ 0, 0;...
200, 0;...
200, 25;...
25, 25;...
25,200;...
0 ,200;...
0 , 0];
end
end
0 件のコメント
回答 (1 件)
Adam Danz
2021 年 9 月 29 日
編集済み: Adam Danz
2021 年 9 月 30 日
In Matlab R2021a or later, you can use formattedDisplayText() to convert the matrix to a string. See this community highlight for further demos.
x = randi(20,5,2)
fprintf('%s',formattedDisplayText(x))
Prior to Matlab R2021a,
fprintf('%s',evalc('disp(x)'))
5 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!