Data format AFTER import into Mathematica from Excel.xls worksheet

In summary, the conversation discusses using an Excel worksheet with unique column titles to create a large number of contour plots in Mathematica. The question is whether Mathematica can use the column titles for subsequent commands and if not, if there is a format that can be used for easy recognition of the column names. A sample Excel sheet and simplified Mathematica notebook would be useful in finding a solution for creating thousands of contour plots.
  • #1
nkormanik
2
0
.
I have a large Excel worksheet (200 columns, 4,000 rows). Every column has a unique and carefully chosen title/label.

I'm attempting to use it within Mathematica to create a large number of contour plots (1,000) -- using three columns at a time, for x, y, z.

The import, I suppose, occurs. At least it appears to have.

Here's the question:

-- Is Mathematica using my column titles, so that I can refer to them in commands subsequent to import?

-- If not, is there any format I can put my data into to begin with so that Mathematica will readily recognize my named columns?


I certainly wanted to be getting on with the contour plots (SmoothDensityHistogram), but am having trouble getting my data into the required form.

Any help appreciated.

Nicholas Kormanik
nkormanik@gmail.com

.
 
Physics news on Phys.org
  • #2
Mathematica is very likely not using your Excel column titles, but we cannot see your code so we cannot be absolutely certain.

If you would be willing to generate a small sample Excel sheet (and save it in an old .XLS format rather than any of the newer formats that some of us don't have a version of Excel new enough to read) with the same number of columns and titles and perhaps half a dozen or a dozen rows

AND create a small simple version of your Mathematica notebook that shows how you are currently importing your Excel sheet and how you would like to refer to your Excel column names when using the data in a contour plot and describes as clearly as possible what you want to see. If you want to generate thousands of contour plots then this should probably include just enough information so that someone can understand how the notebook needs to be able to do that. These last parts don't necessarily need to work, but they need to communicate clearly enough that someone with Mathematica experience can understand what they need to write for you.

THEN someone might be able to take a few minutes and see if they can find a way to fiddle the notebook contents to make it do what you want.
 

Related to Data format AFTER import into Mathematica from Excel.xls worksheet

1. What is the best way to import data from an Excel spreadsheet into Mathematica?

The most efficient way to import data from an Excel spreadsheet into Mathematica is to use the built-in function Import["file.xls", "Data"]. This will import the data from the first sheet in the Excel file as a list of lists, where each sublist corresponds to a row in the spreadsheet.

2. How can I specify which sheet to import data from in an Excel file?

You can specify which sheet to import data from by using the "DataSheet" option in the Import function. For example, Import["file.xls", "Data", "DataSheet" -> "Sheet2"] will import data from the second sheet in the Excel file.

3. Can I import only specific columns from an Excel spreadsheet into Mathematica?

Yes, you can use the "DataRange" option in the Import function to specify which columns to import. For example, Import["file.xls", "Data", "DataRange" -> {All, {1,3,5}}] will import data from columns 1, 3, and 5 in the Excel file.

4. How can I handle missing data or errors during the import process?

If there is missing data or errors in the Excel spreadsheet, you can use the "HeaderLines" and "SkipLines" options in the Import function to skip over these lines and only import the data you need. Alternatively, you can use the "DataRules" option to specify how to handle missing data or errors during the import process.

5. Is it possible to export data from Mathematica back into an Excel spreadsheet?

Yes, you can use the Export function in Mathematica to export data back into an Excel spreadsheet. The syntax is Export["file.xls", data], where data is the data you want to export. You can also specify which sheet to export the data to using the "DataSheet" option.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
18
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
823
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
9K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
Back
Top