write an array (or other data) to a file in matlab
to write a file in matlab, you first need to get a file id:
>> fid = fopen('nameofyourfile.txt','w')(the 'w' means that this file will completely overwrite whatever file shares the same filename)
to write to the file, use the fprint command:
>> fprintf(fid,%d,5);this puts the number 5 into nameofyourfile.txt.
to prevent the file handling gnomes from attacking you in the night, be sure to close the file when you're finished writing all of your data:
>> fclose(fid);
0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home