how to export numerical values to ASCII format

조회 수: 26 (최근 30일)
Niki
Niki 2016년 11월 4일
댓글: shima inanloo 2019년 8월 1일
Actually I am having a hard time to do it. I use R nowadays i forgot how to export my data in matlab. I searched and I could not find a way to do it.
I tried
save('TheNameYouwant.txt','TheNameOfFile', '-ascii');
but this is not what I want. I want to have the output as Tab Delimited text
  댓글 수: 1
shima inanloo
shima inanloo 2019년 8월 1일
hi niki !
try this :
foe example, you have the result Zx and the input variables are X :
A = [X;Zx];
fileID = fopen('f.txt','w');
fprintf(fileID,'%6s %12s\n','X','A');
fprintf(fileID,'%6.2f %12.8f\n',A);
fclose(fileID);
I hope it will help you.

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

채택된 답변

Image Analyst
Image Analyst 2016년 11월 4일
Try dlmwrite
dlmwrite('TheFileNameYouWant.txt', yourMatrix, '\t');

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by