Reputation: 737
I have multiple arrays of data, out of which only x,y and z arrays are required to be exported as text. I know how to export a single array, but am unable to export the 3 columns of data as text file. please help, I tried with the following..
fid = fopen('g.txt','w');
fprintf(fid,'%f \n',x,y,z);
fclose(fid);
Upvotes: 1
Views: 29676
Reputation: 8038
You don't want delimiter write, you want csvwrite
. It will open nicely in Excel and similar programs.
The following example creates a comma-separated value file from the matrix m.
m = [3 6 9 12 15; 5 10 15 20 25; ...
7 14 21 28 35; 11 22 33 44 55];
csvwrite('csvlist.csv',m)
type csvlist.csv
3,6,9,12,15
5,10,15,20,25
7,14,21,28,35
11,22,33,44,55
See http://www.mathworks.com/help/matlab/ref/csvwrite.html
Upvotes: 3