- #1
- 47
- 0
I have output (stored in variable "x") that I want saved into a simple text file. If I use the command:
fprintf('%d\n',x);
it prints the data in a nice column. This is what I want. Then to save it to a file I try this:
fileID = fopen('x.txt');
fprintf('%d\n',x);
fclose(fileID);
however Matlab does not like this. When I searched the help file, it gave a similar example, so what am I doing wrong here? Thanks in advance!
fprintf('%d\n',x);
it prints the data in a nice column. This is what I want. Then to save it to a file I try this:
fileID = fopen('x.txt');
fprintf('%d\n',x);
fclose(fileID);
however Matlab does not like this. When I searched the help file, it gave a similar example, so what am I doing wrong here? Thanks in advance!