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

Home » Public Forums » archive » Re: a strange loop problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: a strange loop problem [message #60943 is a reply to message #60941] Tue, 24 June 2008 00:33 Go to previous messageGo to previous message
Anthony[1] is currently offline  Anthony[1]
Messages: 20
Registered: December 2006
Junior Member
On Jun 24, 3:53 am, bulrushmo...@gmail.com wrote:
> What is wrong with the loop for the following:
> i=0
> Print, 'SDS_NAME'+STRTRIM(string(i+1),2), prints SDS_NAME01
> But, Band = hdf_sd_nametoindex(file, 'SDS_NAME'+STRTRIM(string(i+1),
> 2)) is not the same with
> Band = hdf_sd_nametoindex(file, SDS_NAME01 )
> ==========================================
> SDS_NAME01 = "SREFL_CH1"
> SDS_NAME02 = "SREFL_CH2"
> SDS_NAME03 = "BT_CH3"
> SDS_NAME04 = "BT_CH4"
> SDS_NAME05 = "BT_CH5"
> SDS_NAME06 = "SREFL_CH3"
> SDS_NAME07 = "SZEN"
> SDS_NAME08 = "VZEN"
> SDS_NAME09 = "RELAZ"
> SDS_NAME10 = "QA"
>
> file = hdf_sd_start(fPath_data
> +"AVH09C1.A1998180.N14.002.2007273131632.hdf")
>
> for i=0, 9 do begin
> Band = hdf_sd_nametoindex(file, 'SDS_NAME'+STRTRIM(string(i+1),2))
> data = hdf_sd_select(file, Band)
> hdf_sd_getdata, data, getdata
> hdf_sd_endaccess, data
>
> endfor

Band = ...(file, 'SDS_NAME01')
is not the same as
Band = ...(file, SDS_NAME01)
Maybe that's the problem?

You could use execute(), e.g.:
Void = execute('Band = ...(file,' + string(...) + ')')

Or why not put the SDS_NAMEs into an array?

SDS_NAMES = ["SREFL_CH1", "SREFL_CH2", ...]
...
for i = 0, 9 do begin
Band = hdf_sd_nametoindex(file, SDS_NAMES[i])
...
endfor

Hope that helps!

Cheers,
Anthony
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Extracting subregions from a data cube
Next Topic: workbench eclipse 3.3.2 patch

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

Current Time: Fri Oct 10 02:09:27 PDT 2025

Total time taken to generate the page: 1.03850 seconds