[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave equivalent to A = mxGetPr(prhs[0]);

From: Fredrik Lingvall
Subject: Re: Octave equivalent to A = mxGetPr(prhs[0]);
Date: Fri, 09 Jun 2006 14:36:25 +0200
User-agent: Thunderbird (X11/20060604)

David Bateman wrote:

 const Matrix tmp = args(0).matrix_value();
  //A_M = mxGetM(prhs[0]);
  A_M = tmp.rows();
  //A_N = mxGetN(prhs[0]);
  A_N = tmp.cols();
  //A = mxGetPr(prhs[0]);
  A = (double*) tmp.fortran_vec();

Solved my problem.

Yes, but the last line probably made a copy of the data with this last
line with the cast to (double *)!! Try adding A.print_info() after and
see what value rep->count has... If it is "1" you've made a copy..


I did  a A[0] = 0.0; and the 1st element of the input parameter was changed to 0 after I
called my oct-file so I think that it worked. But anyway, how do you suggest that I should
write the code?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]