From: Junglen Tobias on
Hi everybody,
I have a problem using mexCallMATLAB in an mexFunction. If I pass the mexFunction arguments directly into the mexCallMatlab, like
mexCallMATLAB(nlhs,plhs,nrhs,prhs, "det");
everything works fine.
When I need more input arguments in the outer mexFunction (say two matrices) and if I want to calculate the Determinant of the second Matrix in the prhs- pointer array, my mexCallMATLAB command looks like:
mexCallMATLAB(nlhs,plhs,nrhs,prhs[1], "det");
As a result a segmentation error occurs.

Any help is welcome!
Best regards
Tobias
From: Junglen Tobias on
"Junglen Tobias" <t.junglen(a)trianel.com> wrote in message <i3h1p3$l1g$1(a)fred.mathworks.com>...
> Hi everybody,
> I have a problem using mexCallMATLAB in an mexFunction. If I pass the mexFunction arguments directly into the mexCallMatlab, like
> mexCallMATLAB(nlhs,plhs,nrhs,prhs, "det");
> everything works fine.
> When I need more input arguments in the outer mexFunction (say two matrices) and if I want to calculate the Determinant of the second Matrix in the prhs- pointer array, my mexCallMATLAB command looks like:
> mexCallMATLAB(nlhs,plhs,nrhs,prhs[1], "det");
> As a result a segmentation error occurs.
>
> Any help is welcome!
> Best regards
> Tobias


Dear all,
I have found the mistake, the right way to do it is
mexCallMATLAB(nlhs,plhs,nrhs,&prhs[1], "det");
because the adress of the mxArray should be the input.
Perhaps this could be helpful to anyone.
Bye, Tobias


From: Jim Rockford on
On Aug 6, 10:17 am, "Junglen Tobias" <t.jung...(a)trianel.com> wrote:
> Dear all,
> I have found the mistake, the right way to do it is
> mexCallMATLAB(nlhs,plhs,nrhs,&prhs[1], "det");
> because the adress of the mxArray should be the input.
> Perhaps this could be helpful to anyone.
> Bye, Tobias


That is useful Tobias, thanks. It's always helpful when people post
the solutions to problems they have posted.

Jim

From: James Tursa on
"Junglen Tobias" <t.junglen(a)trianel.com> wrote in message <i3h5h0$ofv$1(a)fred.mathworks.com>...
>
> ... the right way to do it is
> mexCallMATLAB(nlhs,plhs,nrhs,&prhs[1], "det");

or mexCallMATLAB(1, plhs, 1, prhs+1, "det");

James Tursa