MathWorks > Matlab

How do I export MATLAB results to MS excel


How do I export the results of MATLAB to excel? I have time, temperature and velocity values in three columns. I want to export the values to Excel. Can anyone help me in this?


When you display the results in your console, use fprintf function. For example if you have temperature (T), velocity (V) and time (t) which you want to export to excel then use the following code to display it:

fprintf('Temperature, Velcoity, Time \n');

fprintf('%8.3f, %8.3f, %8.3f \n',T, V, t);

It will display the results in the console. You can copy the results and paste it in notepad.
Save the notepad file as "name.csv"

When you open that CSV file you will see the values of Temperature, Vel. and time in three separate columns. You can copy each column in excel or use the CSV as excel. But you will not be able to save formatting in CSV so its better to copy in excel.


[0] Message Index


Go to full version