fprint f help with printing a list
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Adam Danz
am 29 Sep. 2021
Bearbeitet: Adam Danz
am 30 Sep. 2021
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 Kommentare
Siehe auch
Kategorien
Mehr zu Debugging and Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!