help-octave
[Top][All Lists]
Advanced

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

Re: Symbolic variable/expression in octave value list


From: Shamika Mohanan
Subject: Re: Symbolic variable/expression in octave value list
Date: Tue, 11 Aug 2015 10:05:42 +0530

If the octave value list contained a double matrix, I would retrieve it as out(0).matrix_value(). Is there something similar for symbolic variable/ _expression_? I do not want to retrieve it as a string value, as I cannot use the string for further calculations.

Shamika

On Mon, Aug 10, 2015 at 9:18 PM, Mike Miller <address@hidden> wrote:
On Mon, Aug 10, 2015 at 11:27:20 +0530, Shamika Mohanan wrote:
> What is the right way to access symbolic expressions in octave value list?
>
> I have the following code-
>
> in = octave_value ('s');
> octave_value_list out =feval ("tf", in, 1);
> std::cout << out(0).string_value()<< std::endl;
>
> This shows the error-
>
> error: octave_base_value::convert_to_str_internal (): wrong type argument
> '<unknown type>'
>
> Is there an equivalent like 'is_double_type()' for symbolic expressions?

I'm not sure what you're asking, but you should be able to fix the
error and get the string representation of an octave_value like this
(untested):

  std::ostringstream os;
  out(0).print (os);
  std::string s = os.str ();

If that's not what you're looking for, can you clarify what you're trying to do?

--
mike


reply via email to

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