fprint f help with printing a list
조회 수: 5 (최근 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!