Category: MATLAB / Octave

Posts related to useful tips & techniques for the MATLAB software by Mathworks. GNU Octave tips & compatibility issues also discussed.

Matlab R2014b: X11 forwarding and OpenGL

The new plotting engine in Matlab R2014b has caused some hangups and reduced quality plots for people using Matlab over X11 forwarding. Consider starting Matlab this way: matlab -nosoftwareopengl figure set(gcf,’renderermode’,'manual’,'renderer’,'painters’) plot(randn(100,1)) If you can’t start Matlab with the -nosoftwareopengl open, omit that open and try plotting with the set(gcf….’painters’) line as shown above for […]

Matlab R2014b: installing the integrated OpenCV support

Initially it appears that to use OpenCV from Matlab R2014b, you will need to write your OpenCV calls in C++, using all the usual Mex stuff. This is not very convenient to me; it would be much more convenient to use the friendly syntax of Python. However the Python support in Matlab R2014b allows passing […]

Matlab 2014b Python: can only pass 1xN vectors!

There seems to be a show-stopper for many uses of the Python interpreter functionality built into Matlab R2014b. It seems you cannot pass matrices! We might investigate reshaping the matrix into a 1xN vector into Python, and reshape back to a matrix when done, but  I think Matlab will make copies at both reshapings. I […]

Cygwin64 HDF5 load() crash fix

Currently, Octave 3.8.1 in Cygwin64 was compiled with headers 1.8.12 but HDF5 library 1.8.13. This causes Octave to seg fault Warning! ***HDF5 library version mismatched error*** and exit. To avoid having to recompile, you can type HDF5_DISABLE_VERSION_CHECK=1 octave to startup octave you can perhaps add to your ~/.bashrc file the line: alias octave=”HDF5_DISABLE_VERSION_CHECK=1 octave -q”

Stop 3-D plot crashing on Matlab over VNC

The process below is for Matlab R2014a and earlier. R2014b and newer do not support the opengl(‘neverselect’) command   Restart Matlab, and before doing anything type: opengl(‘neverselect’) Then at plotting time: figure set(gcf,’renderermode’,'manual’,'renderer’,'painters’) slice(..) and so on

Autoscaling imagesc() plot and imshow() plots

Octave 3.8 has default axis scaling that scales x and y axes proportionally to the axes values. So if one axis values span a much wider range than the other axis, the smaller span axis gets very thin. You can simply insert the line axis(‘normal’) after imagesc() In Matplotlib 1.3, the same issue occurs, which […]

Using P.C. Hansen’s AIRtools and ReguTools in Python using Oct2Py

For those working with real-world inverse problems, P.C. Hansen’s AIRtools and ReguTools are great ways to quickly try out inverse methods. As in general in Python and Matlab, you need to be sure that your column vector of observations “b” is actually passed into the functions as a column vector. I’ll illustrate the issue by […]

Matlab R2014a Fortran MEX on Ubuntu 14.04

Test: 0) in terminal: cp /usr/local/MATLAB/R2014a/extern/examples/refbook/* /tmp/ 1) in matlab: mex -setup FORTRAN 2) in matlab: >> mex /tmp/timestwo.F Building with ‘gfortran’. MEX completed successfully 3) in matlab: timestwo(3) ans = 6.0

Ubuntu 14.04: stop Octave 3.8.1 autoload all packages

The current default setup for Octave 3.8.1 on Ubuntu 14.04 is to load all install packages at startup. I find this irritating and a not recommended practice by the Octave creator JWE. Instead of starting up in 0.1 seconds, Octave takes 5 seconds to start — really annoying, especially when using oct2py in Python! Here’s […]

Matlab R2013b C++ MEX on Ubuntu 14.04

Ubuntu 14.04 comes with GCC 4.8, but Matlab R2013b wants GCC 4.8. The error you will get includes. Warning: You are using gcc version ’4.8.2′. The version of gcc is not supported. Note that Matlab R2014a uses a new system for MEX configuration. You should not use this process for R2014a and newer. For Matlab […]