How to write data to text file with the same space before and after values?
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi, I want to write data to text file using fprintf. I want to get the output like the the attachment (expected). However, I got an output with messy space (result). Is there a way to handle this matter? I would very appreciate it.
댓글 수: 2
채택된 답변
KSSV
2022년 10월 8일
You need to proceed like shown below.
A = rand(4) ;% Demo matrix
[mrows, ncols] = size(A) ;
fmt = [repmat('%f ', 1, ncols) '\n'] ;
fprintf(fmt, A.')
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Other Formats에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!