Effacer les filtres
Effacer les filtres

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

5 vues (au cours des 30 derniers jours)
EM geo
EM geo le 2 Nov 2018
Modifié(e) : EM geo le 2 Nov 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?

Réponses (1)

madhan ravi
madhan ravi le 2 Nov 2018
Modifié(e) : madhan ravi le 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 commentaire
EM geo
EM geo le 2 Nov 2018
Modifié(e) : EM geo le 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).

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by