write a txt file in a format starting vector?
I want to do the opposite of what has been explained in this question:
开发者_如何学运维problems with data acquisition from MATLAB
I would pass by the vectors (eg. codeserv = [NNNNNNNNNN ....]
area = [IIIIIII ....] [.........]
) to create the text file with the same format as in the link, ie:
* Comment line
| Code | serv | etc. ...
* Comment line
Figures | Figures | Figures | etc. ......
We must rebuild a new drive or you can adapt the code?
Thanks for your help and information about it.
Here is a little sample, what should help you to save your first file out of Matlab onto your hard drive.
%some nr to integrate into the printf
num=2.0
%opens the file: 'file_name' with write access
f = fopen(file_name,'w');
%writes some text into the file
fprintf(f,'test-file dump\r\n');
%writes text and includes a fload number out of matlab workspace
fprintf(f,'some-float=%f \r\n', num);
%important closes the file, other wise no other program can grand write access on the file
fclose(f);
Hopefully it helps.
Instead of using textscan in order to scan some input, you may use fprintf for output.
精彩评论