Interaction with MATLAB/Octave
Since both numerical computing environments are provide with a fourth-generation programming language, we discourage the straightforward inclusion of code from any of these two. There is no gain in terms of speed, resource usage, or coding power. In the extreme and rare cases, in which a specific routine is not available in SciPy, the preferred way to bring it to our session is by generating C code from the MATLAB/Octave code, and then wrap it with any of the methods suggested in the Interaction with C/C++ section of this chapter.
There is a different story when we receive data created from within MATLAB or Octave. SciPy has a dedicated module to deal with this situation—scipy.io
.
Let's show you by example. We start with Octave, where we generate a Delaunay triangulation of a random set of 10 points in the plane.
We save the coordinates of these points, as well as the pointers to the triangles in the triangulation, to a MATLAB-style file (version...