Difference between revisions of "Software tutorial/Loading data in MATLAB or Python"

From Process Model Formulation and Solution: 3E4
Jump to navigation Jump to search
m (Created page with "A number of people asked me how to load data into MATLAB and Python after our class on the poor ability of spreadsheets to do serious engineering calculations. Here are some fun...")
 
m
Line 1: Line 1:
A number of people asked me how to load data into MATLAB and Python after our class on the poor ability of spreadsheets to do serious engineering calculations.
A number of people asked me how to load data into MATLAB and Python after our class on the poor ability of spreadsheets to do serious engineering calculations.


Here are some function that you can use in either language.
Here are some functions that you can use in either language.
 
{| class="wikitable"
|-
! File format
! MATLAB
! Python
|-
| width="20%" valign="top" |
Excel files
| width="40%" valign="top" |
<tt>xlsread(...)</tt> and <tt>xlswrite(...)</tt>
Can read both the text and values in an Excel file.  Cell containing formulas are imported as the result of the formula value.
| width="40%" valign="top" |
Excel files
|-
[http://en.wikipedia.org/wiki/XML XML files] are rapidly becoming a fairly standard import and export format for data, because it describes both the data and the nature of the data in the file.
|
<tt>xmlread</tt> and <tt>xmlwrite(...)</tt>. 
|
XML Python
|}

Revision as of 16:53, 2 December 2010

A number of people asked me how to load data into MATLAB and Python after our class on the poor ability of spreadsheets to do serious engineering calculations.

Here are some functions that you can use in either language.

XML files are rapidly becoming a fairly standard import and export format for data, because it describes both the data and the nature of the data in the file.
File format MATLAB Python

Excel files

xlsread(...) and xlswrite(...) Can read both the text and values in an Excel file. Cell containing formulas are imported as the result of the formula value.

Excel files

xmlread and xmlwrite(...).

XML Python