List functions on fprintf

조회 수: 2 (최근 30일)
Abra dog
Abra dog 2011년 10월 31일
How do you list something on fprintf? I want them in a column than kyou
  댓글 수: 2
Jan
Jan 2011년 10월 31일
And what do you want to appear in this list? Have you read "help fprintf" already?
Abra dog
Abra dog 2011년 10월 31일
I have read fprintf but i'm still a little bit confused about it.
I want it to display two columns the first is numbers and the second is a string

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

채택된 답변

Walter Roberson
Walter Roberson 2011년 10월 31일
fprintf('%10.2f\n', YourMatrix)
  댓글 수: 3
Walter Roberson
Walter Roberson 2011년 10월 31일
If you need to display a mix of numbers and strings on a single line, then you need to loop over each line. For example:
for K = 1:length(YourMatrix)
fprintf('%10.2f %s\n', YourMatrix(K), YourStrings(K,:));
end
Abra dog
Abra dog 2011년 11월 1일
One more question when i tried your way for some reason it would repeat what i typed for my whole matrix did I do something wrong?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by