[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pb with oct file, return a matrix
From: |
John W. Eaton |
Subject: |
pb with oct file, return a matrix |
Date: |
Wed, 22 Apr 2009 11:50:51 -0400 |
On 22-Apr-2009, Alain Baeckeroot wrote:
| I wrote a DEFUN_DLD and have trouble to return a matrix, it segfault
| at return retval or in main program M=boucle_cc(...)!
| I tried to run in gdb (and mkoctfile -g) but it does not help me.
|
| I think i have exactly copied a working DEFUN_DLD i have which
| returns a matrix, but ...
|
| Any help/hint/url is welcome :-)
| Alain
|
| ------------------------------------------------------
| Here is the code (with printf for debugging)
| DEFUN_DLD( boucle_cc, args, nargout, "usage : rMat = boucle_cc(..)\n") {
| int NDATA=10000;
| Matrix rMat(NDATA, 22); // results
| octave_value_list retval; // list of return values
|
| ...compute and put everything in rMat...
|
| printf(" ici boucle_cc 7, avant retval(0)= rMat\n");
| printf(" rMat(0,0) = %lf, (9999,21) = %lf;\n", rMat(0,0),
rMat(9999,21) );
| retval(0) = rMat;
| printf(" ici boucle_cc 8, avant return retval\n");
| return retval;
| }
Does it work if you simplify your function to be just the following:
DEFUN_DLD( boucle_cc, args, nargout, "usage : rMat = boucle_cc(..)\n") {
int NDATA=10000;
Matrix rMat(NDATA, 22, 0.0); // results
octave_value_list retval; // list of return values
retval(0) = rMat;
return retval;
}
? If so, then I'd guess that you have some problem in the
| ...compute and put everything in rMat...
part. Given the error message you see, I'd guess that you are writing
outside the bounds of the rMat array. But that's just a guess.
jwe
- pb with oct file, return a matrix, Alain Baeckeroot, 2009/04/22
- pb with oct file, return a matrix,
John W. Eaton <=
- Re: pb with oct file, return a matrix, Alain Baeckeroot, 2009/04/22
- Re: pb with oct file, return a matrix, John W. Eaton, 2009/04/22
- Re: pb with oct file, return a matrix, Alain Baeckeroot, 2009/04/23
- Re: pb with oct file, return a matrix, Jaroslav Hajek, 2009/04/23
- Input redirection (was: Re: pb with oct file, return a matrix), Søren Hauberg, 2009/04/23
- Re: pb with oct file, return a matrix, Alain Baeckeroot, 2009/04/24