Azzera filtri
Azzera filtri

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

5 visualizzazioni (ultimi 30 giorni)
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?

Risposte (1)

madhan ravi
madhan ravi il 2 Nov 2018
Modificato: madhan ravi il 2 Nov 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 Commento
EM geo
EM geo il 2 Nov 2018
Modificato: EM geo il 2 Nov 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).

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by