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!