Borrar filtros
Borrar filtros

Writing data into a file when using repmat

1 visualización (últimos 30 días)
Ram
Ram el 26 de Ag. de 2011
I have a set of data that I generate using repmat x=5; y=[repmat(x, 1, 5)];fn=fopen('A.txt', 'w');fprintf(fn, '%g\t%g\t%g\t%g\t%g\t\r\n', y)
How do I set it up so that I do not have to type in %g\t as many times as I am using in the repmat.
Thanks for any inputs

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 26 de Ag. de 2011
[repmat('%g\t',1,5),'\r\n']
  3 comentarios
Walter Roberson
Walter Roberson el 27 de Ag. de 2011
fprintf(fn, [repmat('%g\t',1,x-1) '%g\r\n'], y);
Fangjun Jiang
Fangjun Jiang el 27 de Ag. de 2011
@Ram, what are you trying to do exactly?

Iniciar sesión para comentar.

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by