From: James Tursa on
"Malcolm McLean" <malcolm.mclean5(a)btinternet.com> wrote in message <i33p14$3pr$1(a)fred.mathworks.com>...
> The problem seems to have gone away.
>
> I was writing a complicated function in a subdirectory. It was full of bugs, and segfaults. Eventually I got it running with a test .m file driver in the subdirectory. I then ran it from the main directory in real code, and it fell over.
> I spent the whole morning looking at why, and finally worked out that when I reduced it to a stub (print hello world) it would still fall over. However when I moved it to the main directory, it worked fine. So I commented the function back in, and simply called mex from the main directory, to create a mexw32 file. It then worked fine.
>
> However I can't replicate the problem. Exactly the same code now seems to run from the subdirectory, as it ought to.

If you get seg faults, the *only* way to ensure that downstream stuff is valid is to completely quit MATLAB and then start MATLAB up fresh. It is not unusual for correct code to run incorrectly if there has been an upstream seg fault in the same session.

James Tursa
From: Malcolm McLean on
"James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message
>
> If you get seg faults, the *only* way to ensure that downstream stuff is valid is to >completely quit MATLAB and then start MATLAB up fresh. It is not unusual for >correct code to run incorrectly if there has been an upstream seg fault in the same >session.
>
I did that, however.
The only thing I can think of is that somehow the segfault affected the compilation of the mex file itself, which doesn't seem likely.