How to write data to text file with the same space before and after values?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ahmad Bayhaqi
am 8 Okt. 2022
Kommentiert: Ahmad Bayhaqi
am 11 Okt. 2022
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 Kommentare
Akzeptierte Antwort
KSSV
am 8 Okt. 2022
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.')
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Text Files finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!