help-octave
[Top][All Lists]
Advanced

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

Re: pb with oct file, return a matrix


From: Jaroslav Hajek
Subject: Re: pb with oct file, return a matrix
Date: Thu, 23 Apr 2009 10:48:12 +0200

On Thu, Apr 23, 2009 at 10:19 AM, Alain Baeckeroot
<address@hidden> wrote:
> Le 22/04/2009 à 18:40, John W. Eaton a écrit :
>>
>> On 22-Apr-2009, Alain Baeckeroot wrote:
>>
>> | Le 22/04/2009 à 17:50, John W. Eaton  écrit :
>> | >
>> | ....
>>
>> If you use the C++ Array indexing operators to access the elements of
>> rMat, then you can try
>>
>>   mkoctfile -DBOUNDS_CHECKING=1 ...
>>
>> and you should see an error message when you run your code if you
>> attempt to access an element of rMat that is out of bounds.
>>
>
> my rMat is ok, its is build in the end of the code, but
> there is some boundary error somewhere previously.
>
> error: T& Array<T>::checkelem (0, 0): range error
> error: called from:
>
> 1/ Is there a simple way to know the name of offending array
>

no. C++ offers no way for variables to get their names. Your only help
is to use a debugger.

> I have 2 other pb for debugging this
> 2/ the fprintf of the DEFUN_DLD appears in the middle of
>  what should have been previoulsy displayed by the main.m ouput
>  (i use fprintf).

you should use octave_stdout (pager.h) if you want your output to mix
with output of other functions normally. That includes going through
the pager if it is enabled. Writing directly to C's stdout bypasses
Octave's I/O mechanisms.


> 3/ I'm a bit confused about range in DEFUN_DLD.
>  in .m  a matrix(3,2) starts at (1,1) and ends (3,2)
>  in .oct                        (0,0)          (2,1)  ?
>

Yes.

-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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