help-octave
[Top][All Lists]
Advanced

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

Re: Convert double to octave_value for assignment to column vector


From: David Grundberg
Subject: Re: Convert double to octave_value for assignment to column vector
Date: Fri, 04 Jun 2010 17:24:36 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4

On 06/04/2010 03:49 PM, babelproofreader wrote:

I still can't get this to work. My code now, heavily commented, is


<snip>


which fails with cc:26: error: no match for ‘operator=’ in ‘retval =
rm_compile_1_output’ and I don't understand why this should be so.

There are several mishaps with the types. An octave_value_list is distinct from an octave_value. One can't exchange them. It seems that octave_value_list and octave_value inherit each other somehow, which makes it trickier to catch. Also, feval returns an octave_value_list, not an octave_value.


An alternative version is to uncomment the lines // *** and use my_retval as
retval, which does compile without error, but when the function is called it
produces
error: octave_base_value::double_value (): wrong type argument `list'

Yes. You can't convert a octave_value_list ('list') to a double. You have to index the octave_value_list using the ()-operator. (Careful though, since the list can be empty!) That way you get an octave_value that you can run double_value() on.


I am really at a loss to understand why, after converting input_median to a
double and assigning it to the output column_vector in the loop, that this
loop output does not seem to be recognised.

It is executed, it's just that Octave can't convert an octave_value_list to a double.

I've attached a changed file which runs and produces some kind of result.

Here to help,
David

Attachment: rm_compile_1.cc
Description: Text Data


reply via email to

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