Fitting Data Imported into Mathematica from Excel

In summary, the conversation discusses importing data into Mathematica 8 and how to fit a curve to the imported data. The speaker suggests using the Import command and shares the code used to import the data. They also mention wanting to fit a specific function to the data and request assistance with this.
  • #1
tjw137
4
0
Can you fit data that is imported into Mathematica 8? I am just using the Import command, and I cannot figure out how to work with this data. I would really like to fit my curve. This is the code I used to import the data: Import[datafile.xlsx"]
 
Physics news on Phys.org
  • #2
If your Excel sheet is big then make up a smaller example sheet, something with perhaps half a dozen rows should be enough to show what it is you want to fit.

Then in Mathematica do the Import.

Select the In[1]:= and Out[1]= cells by clicking on the thin little cell bracket along the far right edge of the notebook. Copy that to the clipboard. Paste that into a reply here.

Then add a bit of text at the bottom of that reply explaining what kind of function you want to Fit to this, a straight line?, a parabola?, some fairly specific simple concrete function you want to fit.

With that it should be fairly simple for someone to take a moment and show you a line or two of code to do what you want.
 

FAQ: Fitting Data Imported into Mathematica from Excel

How do I import data from Excel into Mathematica?

To import data from Excel into Mathematica, you can use the Import function. This function takes in the path to the Excel file as an argument, and you can specify the sheet and range of data you want to import. For example, Import["file_path.xlsx", {"SheetName", "Range"}].

What data formats are supported for importing into Mathematica from Excel?

Mathematica supports importing data from Excel in various formats, including XLS, XLSX, and CSV. You can specify the format in the Import function by adding the format as a third argument, for example, Import["file_path.xlsx", {"SheetName", "Range"}, "XLSX"].

How do I handle missing data when importing from Excel into Mathematica?

When importing data from Excel, Mathematica will automatically handle missing data by converting it to the appropriate missing data representation, which is Missing["NotAvailable"] by default. However, you can also specify a different missing data representation using the MissingDataRules option in the Import function.

Can I modify the imported data in Mathematica?

Yes, you can modify the imported data in Mathematica using various functions and methods. For example, you can use the Part function to extract specific elements from the imported data, or you can use the Map function to apply a function to every element in the imported data.

How can I export data from Mathematica back to Excel?

To export data from Mathematica back to Excel, you can use the Export function. This function takes in the data you want to export and the desired file format as arguments. For example, Export["file_path.xlsx", data, "XLSX"]. You can also specify the sheet and range of cells you want to export the data to.

Similar threads

Replies
4
Views
1K
Replies
4
Views
1K
Replies
1
Views
1K
Replies
5
Views
2K
Replies
9
Views
723
Replies
1
Views
199
Back
Top