MATLAB Answers

how to export numerical values to ASCII format

112 views (last 30 days)
Niki
Niki on 4 Nov 2016
Commented: shima inanloo on 1 Aug 2019
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 Comment

shima inanloo
shima inanloo on 1 Aug 2019
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.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 4 Nov 2016
Try dlmwrite
dlmwrite('TheFileNameYouWant.txt', yourMatrix, '\t');

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags


Translated by