Author Topic: How do I export MATLAB results to MS excel  (Read 12046 times)

Offline piso

  • Newbie
  • *
  • Posts: 13
  • Reputation: +3/-0
  • Searching for solution
    • View Profile
How do I export MATLAB results to MS excel
« on: January 17, 2012, 08:03:50 PM »
Advertisement
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?

Thanks.

Offline mali28

  • Newbie
  • *
  • Posts: 15
  • Reputation: +0/-0
  • Searching for solution
    • View Profile
Re: How do I export MATLAB results to MS excel
« Reply #1 on: January 19, 2012, 06:02:31 PM »
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.