help-octave
[Top][All Lists]
Advanced

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

Re: casting


From: Søren Hauberg
Subject: Re: casting
Date: Fri, 09 Mar 2007 23:36:08 +0100
User-agent: Thunderbird 1.5.0.10 (X11/20070307)

How about this function:

function B = cast(A, newclass)
  B = feval(newclass, A);
endfunction

If it were to be included in octave it would need to include some input checking but otherwise I think it does what you need.

Søren

David Grohmann skrev:
I attempted to do a cast in octave 2.9.9 and it was not defined.

like this:
a = cast( 3.14159, 'uint32')

where 'a' should equal 3 afterwards

does this function still need to be written? seems easy enough, perhaps I could write the mex file to do it?

is there another way to achieve this?

Thanks,



reply via email to

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