Borrar filtros
Borrar filtros

how can i create a .txt file from vectors with different length?

5 visualizaciones (últimos 30 días)
EM geo
EM geo el 2 de Nov. de 2018
Editada: EM geo el 2 de Nov. de 2018
I need to create a txt file with vector having different lenght. I wrote this code but the position of each cell is changed.
fileID = fopen('BN_for_prediciting_zeros_argilliti_v1.sae','w');
fprintf(fileID,'L_mean_argil, L_Min_argil, L_Max_argil, R_mean_argil, R_Min_argil, R_Max_argil, Zero_argil\n');
fprintf(fileID,'%6.4f, %6.4f, %6.4f, %6.4f, %6.4f, %6.4f, %6.4f \n', L_mean_argil, L_Min_argil, L_Max_argil, R_mean_argil, R_Min_argil, R_Max_argil, Zero_argil');
fclose(fileID);
Can someone help me?

Respuestas (1)

madhan ravi
madhan ravi el 2 de Nov. de 2018
Editada: madhan ravi el 2 de Nov. de 2018
a=1:10 %an example assuming datas are numeric
b=1:15
dlmwrite('sample.txt',a,'delimiter')
dlmwrite('sample.txt',b,'delimiter','-append')
  1 comentario
EM geo
EM geo el 2 de Nov. de 2018
Editada: EM geo el 2 de Nov. de 2018
tnk you for the reply. I wrote this code:
a = L_mean_argil %an example assuming datas are numeric
b = R_Min_argil
dlmwrite('sample.txt',a,'precision','%6.4f','coffset',1)
dlmwrite('sample.txt',b,'precision','%6.4f','coffset',1)
but it write only the second matrix (b). How can i add the first one too? With append it insert the second colum behind the first but i need a column for each variable, and i need the name of the variable too (in the first row).

Iniciar sesión para comentar.

Categorías

Más información sobre Logical 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!

Translated by