How to write data to text file with the same space before and after values?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ahmad Bayhaqi
el 8 de Oct. de 2022
Comentada: Ahmad Bayhaqi
el 11 de Oct. de 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 comentarios
Respuesta aceptada
KSSV
el 8 de Oct. de 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.')
Más respuestas (0)
Ver también
Categorías
Más información sobre Text Files en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!