Exchanging information with MATLAB/Octave
MATLAB and its open source alternative Octave are popular numerical programs and programming languages. Octave and MATLAB have syntax very similar to Python's. In fact, you can find websites that compare their syntax (for instance, see http://wiki.scipy.org/NumPy_for_Matlab_Users).
Note
Download Octave from http://www.gnu.org/software/octave/download.html.
The most recent Octave version at the time of writing was 3.8.0. The scipy.io.savemat()
function saves an array in a file compliant to the Octave and MATLAB format. The function accepts as parameters the name of the file and a dictionary with a name for the array and the values. Refer to the octave_demo.py
file in this book's code bundle:
import statsmodels.api as sm from scipy.io import savemat data_loader = sm.datasets.sunspots.load_pandas() df = data_loader.data savemat("sunspots", {"sunspots": df.values})
The preceding code stores sunspots data in a file called...