필터 지우기
필터 지우기

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

조회 수: 5 (최근 30일)
EM geo
EM geo 2018년 11월 2일
편집: EM geo 2018년 11월 2일
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?

답변 (1개)

madhan ravi
madhan ravi 2018년 11월 2일
편집: madhan ravi 2018년 11월 2일
a=1:10 %an example assuming datas are numeric
b=1:15
dlmwrite('sample.txt',a,'delimiter')
dlmwrite('sample.txt',b,'delimiter','-append')
  댓글 수: 1
EM geo
EM geo 2018년 11월 2일
편집: EM geo 2018년 11월 2일
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).

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by