How to export Matlab curve-fitted data to excel?

In summary, the conversation is about exporting curve-fitted y points from MATLAB to excel. The suggested solution is to write the coefficients to a .csv file and then read them into excel. The person asking the question is using a Gaussian fit and is unsure how to use the coefficients as a function in excel.
  • #1
Si14
75
0
Hi all,

I have used MATLAB curve fit tool to curve-fit a set of x-y points. Now I want to export the curve-fitted y point to excel.

Any idea how to do this?

Thank you very much.
 
Physics news on Phys.org
  • #2
write the coefficients to a .csv file and read them into excel
 
  • #3
Dr Transport said:
write the coefficients to a .csv file and read them into excel

Thank you for your reply.
Could you explain more. Do you mean copy/paste the coeff of the resulted curve-fitted function to an excel file?
I am using a Gaussian fit. It gives me the Gaussian expression which is defined by about 24 coefficients and these coefficients are given separately below the expression. Something like this:

f(x) =
a1*exp(-((x-b1)/c1)^2) + a2*exp(-((x-b2)/c2)^2) +
...

and a1, b1, c1 and so on are defined below this expression.

So I wonder if I copy/paste these coefficients to excel, and also the formula, how can I use it as a function in excel. I am not very familiar with excel.

Thank you.
 

FAQ: How to export Matlab curve-fitted data to excel?

1. How do I export my curve-fitted data from Matlab to Excel?

To export your curve-fitted data from Matlab to Excel, you can use the "xlswrite" function. This function allows you to export data to an Excel spreadsheet file. You will need to specify the file name and the range of cells in which you want to export the data. For more detailed instructions, you can consult the Matlab documentation.

2. Can I export multiple curves from Matlab to different sheets in one Excel file?

Yes, you can export multiple curves from Matlab to different sheets in one Excel file. To do this, you will need to use the "xlswrite" function and specify the sheet name for each curve. You can also use a loop to automate the process if you have a large number of curves to export.

3. What format will my data be in when exported from Matlab to Excel?

The data will be exported in a comma-separated value (CSV) format. This means that each data point will be separated by a comma and each row will represent a different curve. You can easily convert this format to a table or graph in Excel for further analysis.

4. How can I ensure the accuracy of my exported data from Matlab to Excel?

To ensure the accuracy of your exported data, it is recommended to double-check the range of cells specified in the "xlswrite" function. Make sure that all the data points you want to export are included in the range. Additionally, you can also check the exported data in Excel to ensure that it matches the data in Matlab.

5. Can I export my curve-fitted data from Matlab to other file formats besides Excel?

Yes, besides Excel, you can also export your curve-fitted data from Matlab to other file formats such as text, HTML, and XML. To do this, you will need to use the "fprintf" function to write the data to a file in the desired format. You can consult the Matlab documentation for more information and examples on exporting data to different file formats.

Similar threads

Replies
2
Views
3K
Replies
18
Views
5K
Replies
2
Views
1K
Replies
8
Views
829
Replies
2
Views
2K
Replies
2
Views
2K
Back
Top