This is my program:
x= 9;
fprintf(' a z \n _ _ \n');
for a = 0:4
z =x+a;
fprintf(' %d %d\n',a,z);
end
how can i convert the output into excel spreedsheet? or file?
The easiest way to get data from Matlab into Excel is writing to a plain text .csv file, then importing that into Excel. To do this, simply open a file
fileID = fopen('mydata.csv','w');
change the fprintf statements to write to that file
x= 9;
fprintf(fileID, ' a, z \n _, _ \n');
for a = 0:4
z =x+a;
fprintf(fileID, ' %d, %d\n',a,z);
end
and make sure to close the file when you are done
fclose(fileID);
Import this into Excel and you can save it as an xls file.
mydata.csv file once you finish with the above code.