May 2008
Importing Data from Excel into Mathcad


There are several ways to import data from Excel, but here are some of the easiest methods. Next month's article will cover exporting to Excel.


You can always copy a number of cells from Excel and paste them into Mathcad. If you paste directly into the worksheet, the numbers paste as an image as below, 



However you can first set up a variable, then paste, and you get a matrix of values, as long as the cells only contain numbers.



If you choose Paste Special, you get several choices including:


Microsoft Excel 2003 Worksheet, which is an OLE object that opens up Excel within Mathcad if you double-click it.



Unformatted Text as Math, which gives you a matrix you can work with.



Unformatted Math as String, which runs all the values together, as you can see below.


 

Data Table


A better option is to select the entire table in Excel and copy it.


Excel Table



Now, create a data table in Mathcad by clicking on Data > Table from the Insert menu, which gives you the blank data table below.



Right-click in any cell in the data table, and select Paste Table.



Click on the data table and use the scroll bars to see more of the content.


Now assign a variable to the table.



Now you can analyze your data.



Data Import Wizard


You can also use the Data Import Wizard to import data from Excel. Click in your worksheet, and choose Data > Data Import Wizard from the Insert menu.

Under Excel Options, you can set the range of cells to import, which rows to skip, and what to do about missing values as you can see below. You must make sure all placeholders are filled. NAN, or Not a Number represents a missing or corrupted value in a dataset.



The Excel component also allows you to exchange data with Excel, but that is a subject for another article. The READFILE function works much like the Data Import Wizard for use in programs.



Right-click, choose Save Target As, and change the extension to XMCD and File Type to All to download Mathcad file. (Mathcad 13).





Was this article helpful? Let us know.









[PRINTER FRIENDLY VERSION]
HOME

Everyday Tips for Navigating Windchill 9.0
PTC Updates
Tips of the Month
Mathcad Methods
Knowledge Base Exclusive
Webcasts & Events
Putting the Pieces Together - Large Assemblies Made Easier
Predicting Iridium Flares

Contact PTC | Privacy Policy | PTC Express Archive | Subscribe | Edit Profile

  PTC, 140 Kendrick Street, Needham, MA 02494 USA