Hi, I'm sorry if I make any mistakes this is my first time posting.
This is my code so far
MatrixA = [100.9 100.8 110.0;102.0 101.0 108.0;104.0 100.1 107.0];
header = {'Batch1','Batch 2','Batch 3'};
MatrixAForDisplay = [header; num2cell(MatrixA)];
disp(MatrixAForDisplay);
My question is, how do I display this matrix using fprintf command?
Thank you so much in advance!

 채택된 답변

KSSV
KSSV 2020년 4월 10일

2 개 추천

header = {'Batch1','Batch 2','Batch 3'};
A = [100.9 100.8 110.0;102.0 101.0 108.0;104.0 100.1 107.0];
fprintf('%s %s %s\n',header{1},header{2},header{3})
fprintf('%f %f %f\n', A.')
It is better to convert them into table and print. Have a look on table.

댓글 수: 2

Thank you for yourr answer!
How would I go about converting it into a table and then displaying it?
T = table(header,A(:1,),A(:,2),A(:,3))

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Type Conversion에 대해 자세히 알아보기

질문:

2020년 4월 10일

댓글:

2020년 4월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by