MATLAB: Saving matlab results

fileMATLABresultssavewrite

hi there, anyone know hot to save results to a file in matlab? suppose i had this x,y,z data that i want to save it as results.str that is openable via matlab. anyone can help? thank you very much

Best Answer

"Put z inthe first column" is not an exact definition of the output. Do you want to write an ASCII file?
FID = fopen(FileName, 'w');
if FID < 0, error(Cannot open file); end
data = [z, y, x];
fprintf(FID, '%g %g %g\n', transpose(data));
fclose(FID);
See "help fprintf", if you want to specify another numerical format, e.g. more digits after the dot.
Related Question