I was stumped by a segmentation fault in MATLAB. It seems like it was caused by an anonymous function that was loaded from a mat file. The original anonymous function handle was:
@(x)scaledNlfun(x,@logexp1,1e3)
But when it is loaded, it becomes:
@sf%1@(x)scaledNlfun(x,@logexp1,1e3)
It seems to be okay, when I call it in command line, but it creates a segmentation fault (or Segmentation violation) within a function. Not the function call itself, but a few lines after that. In debugging mode, if I step through the statement, it is fine as well.
The stack trace shows bunch of
[ 0] 0x00002b20b97baba4 /usr/local/MATLAB/R2013a/bin/glnxa64/libmwm_interpreter.so+04127652
and it happens on both MATLAB 2012a and 2013a on a Linux 2.6.18-371.3.1.el5 SMP.
This function handle was saved within a parfor loop using '-v7.3' option because the struct that contains the handle was too big. If I replace the anonymous function after loading the mat file, everything works fine, so I'm thinking the matlab load function has a bug.
Unfortunately, I cannot create a minimal example to reproduce the error. I tried saving anonymous function handles within parfor with '-v7.3', but without the other complex data structures, it seems to work fine. But I have 80 mat files that would reliably crash matlab (many of them more than 1GB).
In any case, does anybody know what that "@sf%" mean? (it's not the stateflow toolbox)
scaledNlfunhave any effect on the segv? - maxywbfunctionson it? - horchlerstr2func? Did you use the'-struct'option for `save? - horchlerparforloop if possible. I tried to give some general tips, but without actual code that causes the problem it is a bit like shooting with closed eyes. - Dennis Jaheruddin