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

Home » Public Forums » archive » converting bytarr into strarr
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
converting bytarr into strarr [message #44514] Tue, 21 June 2005 14:52
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Hello there,

This is probably a simple question, but I haven't found out how to do it.

How does one convert a byte array into a equivalent sized string array? E.g. consider the
following:

IDL> a=bindgen(20,40)
IDL> help, a
A BYTE = Array[20, 40]
IDL> b=string(a)
IDL> help, b
B STRING = Array[40]
IDL>

or

IDL> a=bindgen(2,4,5,6)
IDL> help, a
A BYTE = Array[2, 4, 5, 6]
IDL> b=string(a)
IDL> help, b
B STRING = Array[4, 5, 6]


What I want to do is convert "a" into a string array, "b", that has the same dimensions as
the original byte array, [20, 40], or [2, 4, 5, 6] i.e. each element of "b" is a single
character corresponding to the byte value in "a".

Everything I've read in the IDL help tells me that a byte array will always "lose" the
first dimension as the bytes are converted into concatenated strings.

Is there a simple way around this? (I could loop over the dimensions of "a" I guess).

thanks,

paulv

--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
[Message index]
 
Read Message
Previous Topic: Re: Escaping Quotes
Next Topic: Re: converting bytarr into strarr

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

Current Time: Wed Oct 08 16:02:24 PDT 2025

Total time taken to generate the page: 0.00454 seconds