Category: MATLAB / Octave

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

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

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 […]

Matlab: imwarp over 3x faster than imtransform

In Matlab R2013a, imwarp was brought in, and by R2013b the Lint warning tells you to use imwarp instead of imtransform. On my simple test (a horizontal linear shift) imwarp was 3.4 times faster than imtransform. I had this inside a for loop (first I loaded an image to variable ‘bg’) bg = imread(‘myimage.jpg’); [nRow,nCol] […]

Matlab Compiler tbb.dll errors

Even with a fresh install of Windows 7 x64 and Matlab R2013b, I was getting tbb.dll related errors after compiling M-scripts using Matlab Compiler deploytool. The exe would compile, but upon running it would issue various tbb.dll errors. This problem happened across multiple PCs. To fix this problem, I followed this process: 1) download latest […]

Matlab readtable(): fixing reading numeric data as text

Matlab’s readtable() function as of R2014a cannot be manually told the spreadsheet column data format. The ‘Format’ ‘%s %f’ option ONLY applies to text files as of R2014a. To help fix a problem where you have a spreadsheet (.xls, .ods) where an all-numeric column is being read as text in cells, highlight that entire column, […]