|
From: | Schirmacher, Rolf |
Subject: | RE: help for vectorisation |
Date: | Fri, 20 Nov 2009 22:03:17 +0100 |
-----Original Message-----
From: Jaroslav Hajek [mailto:address@hidden
Sent: Friday, November 20, 2009 12:08 PM
To: Schirmacher, Rolf
Cc: address@hidden
Subject: Re: help for vectorisationHere's an approach that's going to work if your signed integers are 2's complement (almost all modern machines).
If I understood correctly what you're trying to do.
DATA = "" # random data at [-1 .. 1]
DATA = "" (typecast (int32 (2^31 * DATA), "uint32"), -8);
MyString = reshape (sprintf ("0x%06x",DATA), 8, []).'
Gosh, if people paid for Octave one-liners, I'd be a millionaire! :D
--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.czThanks Jaroslav,The nice thing about octave is that you can do all that in one line - and unfortunately I am not aware of at least half the tricks you know. E.g., I have never thought about reshaping sprintf-output - stupid.Works great and is really MUCH faster of course - as all your code!Rolf
[Prev in Thread] | Current Thread | [Next in Thread] |