octave-maintainers
[Top][All Lists]
Advanced

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

problem with sum (...)


From: Ben Abbott
Subject: problem with sum (...)
Date: Sat, 3 Nov 2007 23:25:27 -0400

I've encountered a problem with the internal function sum(), using 2.9.16

The test below produces the correct result

        sum ([true, false])
        ans = 1

The result is *not* logical (which is consistent with Matlab).

        islogical (sum ([true, false]))
        ans = 0

However, when asked to return the result in the native format of the inputs (as Matlab does) ...

        islogical (sum ([true, false], 'native'))
        error: invalid conversion from string to real scalar
        error: octave_base_value::int_value (): wrong type argument `sq_string'
        error: evaluating argument list element number 1

While Matlab produces this result ans=1, which is consistent with Octave when the test is modified as ...

        islogical (logical (sum ([true, false])))
        ans = 1

When the arguments to sum are characters and accompanied by 'native', Matlab produces an error.

I'm not up to c++ programing. So I will not be any help in modifying the internal function, sum ().

However, I am working on the ismember.m, and this is my current road block (more to follow).

Is anyone up to working on this?

Ben


reply via email to

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