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

Home » Public Forums » archive » Re: How to convert (concatenate) a string array to a string scalar?
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
Re: How to convert (concatenate) a string array to a string scalar? [message #19276] Mon, 13 March 2000 00:00
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
Kristian Kjaer wrote:
>
> Given
> numarray= ;, say, I wan't
> strscalar='1342,1347,1355' ;, but
> help,string(numarray)
> gives: STRING = Array
> and
> help,total(string(numarray))
> gives an error.
>
> How to convert (concatenate) a string array to a string scalar?
>
> Thanks for any help,
> Kristian Kj�r.

Try:

help,string(numarray,format='(3A)')
(no loop ;-)

Cheers,
Martin


PS: In case you don't know the array dimension exactly, the format
method also
works:
help,string(numarray,format='(9999A)')
But don't go beyond 32767!

And here is another (academic) solution:
help,string(reform(byte(string(numarray)),24))


--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
Re: How to convert (concatenate) a string array to a string scalar? [message #19280 is a reply to message #19276] Mon, 13 March 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Carsten Dominik (dominik@astro.uva.nl) writes:

> STRJOIN in idl 5.3

Oh, I just *knew* it. :-(

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: How to convert (concatenate) a string array to a string scalar? [message #19281 is a reply to message #19276] Mon, 13 March 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Kristian Kjaer (kristian.kjaer@risoe.dk) writes:

> Given
> numarray=[1342,1347,1355] ;, say, I wan't
> strscalar='1342,1347,1355' ;, but
> help,string(numarray)
> gives: STRING = Array[3]
> and
> help,total(string(numarray))
> gives an error.
>
> How to convert (concatenate) a string array to a string scalar?

Now here (I feel pretty darn confident) is the perfect
opportunity to use a loop in IDL. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: How to convert (concatenate) a string array to a string scalar? [message #19282 is a reply to message #19276] Mon, 13 March 2000 00:00 Go to previous message
Carsten Dominik is currently offline  Carsten Dominik
Messages: 45
Registered: February 1998
Member
>>>> > "KK" == Kristian Kjaer <kristian.kjaer@risoe.dk> writes:

KK> Given numarray=[1342,1347,1355] ;, say, I wan't
KK> strscalar='1342,1347,1355' ;, but help,string(numarray) gives:
KK> STRING = Array[3] and help,total(string(numarray)) gives an error.

KK> How to convert (concatenate) a string array to a string scalar?

STRJOIN in idl 5.3

- Carsten

--
Carsten Dominik <dominik@astro.uva.nl> \ _ /
Sterrenkundig Instituut "Anton Pannekoek" |X| _
Kruislaan 403; NL-1098 SJ Amsterdam /| |\ _ _ _/ \
phone +31 (20) 525-7477; FAX +31 (20) 525-7484 ___|o|____/ ~~ \___/ ~~~~~
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: need help MS powersation fortran external
Next Topic: Re: matching lists

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

Current Time: Wed Oct 08 15:28:09 PDT 2025

Total time taken to generate the page: 0.00611 seconds