comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » appending to column
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
appending to column [message #61378] Wed, 16 July 2008 09:02 Go to next message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
Folks
I have a float array that first column is the integer part and second
column is the decimal part of that number. How I can append this to
column to get one column of that float number. For example:

[123,456]------> 123.456
……… ……….
Thanks
Cheers
Re: appending to column [message #61455 is a reply to message #61378] Wed, 16 July 2008 11:22 Go to previous message
R.G. Stockwell is currently offline  R.G. Stockwell
Messages: 363
Registered: July 1999
Senior Member
"Jean H" <jghasban@DELTHIS.ucalgary.ANDTHIS.ca> wrote in message
news:g5lb22$inp$1@news.ucalgary.ca...
>> IDL> print,a
>> 0 1
>> 2 3
>> 4 311
>> IDL> print,a[0,*] +
>> float(a[1,*])/10^strlen(strcompress(string(a[1,*]),/rem))
>> 0.100000
>> 2.30000
>> 4.31100
>>
>>
>> Cheers,
>> bob
>
> While using strings, we can make it more efficiently. There is no need to
> do any division, get the length or anything:
>
> IDL> help, 1 + float('0.'+strtrim(234,2))
> <Expression> FLOAT = 1.23400
>
> Jean

It is always a trade-off. Do you want an answer fast,
or do you want an answer that is right?

lol

Cheers,
bob
Re: appending to column [message #61458 is a reply to message #61378] Wed, 16 July 2008 10:54 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jean H writes:

> 1) get the number of digits for the decimal part

This is the part that's handy to know. I could have
saved myself a hell of a lot of effort in the past, had
I known about this.

I shouldn't have taught myself how to write programs.
This is probably taught in Programming 101 today. :-(

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: appending to column [message #61460 is a reply to message #61378] Wed, 16 July 2008 10:48 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On Jul 16, 11:27 am, Jean H
> IDL> help, 1 + float('0.'+strtrim(234,2))
> <Expression>    FLOAT     =       1.23400

Nifty.

Mike
--
www.michaelgalloy.com
Tech-X Corporation
Software Developer II
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Save File Surprise
Next Topic: Unique Identifier

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:51:41 PDT 2025

Total time taken to generate the page: 0.00462 seconds