fprintf
조회 수: 21 (최근 30일)
이전 댓글 표시
I'm having a bit of trouble with my fprintf
example :
x = 35
y = column of words
fprintf('%g blah blah blah %s',x,y{:})
fprintf then displays
35 blah blah word1
66 blah blah word2
.
.
.
.
how do i make it so it display
35 blah blah
list of words
댓글 수: 3
Fangjun Jiang
2011년 11월 1일
You have more data than the '%g' and '%s' specified so '%g' and '%s' will be used repeatedly. Apparently, '%g' won't be the right format for strings.
fprintf('%g blah blah\n',x);
fprintf('%s\n',y{:});
채택된 답변
추가 답변 (1개)
Jan
2011년 11월 1일
You need 2 FPRINTF commands:
fprintf('%g blah blah blah\n', x);
fprintf('%s\n', y{:});
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Argument Definitions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!