comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: do loop
items: Re: do loop

do loop
type: item
description: hi, I have col1 =dep[0, 0: 49] col11 =dep[0, 50: 99] col21 =dep[0, 100:149] col31 =dep[0, 150:199] col41 =dep[0, 200:249] col51 =dep[0, 250:299] col61 =dep[0, 300:349] col71 =dep[0, 350:399] col81 =dep[0, 400:449] col91 =dep[0, 450:499] ;;;;;;;;;;;;;;;;;;;;;;;;;; I want to make this as do loop how can i do it ?
creator: Ali Gamal
date: 2016-04-15T13:13:45-00:00

Re: do loop
type: item
description: Don't try to put the indices in the variable name - you'll regret it. Do this instead: col=reform(dep[0,0:499],50,10) then you can access your 'col1' with col[*,0], 'col11' with col[*,1] etc. Otherwise your next question will be "How do I loop through col1, col11...?" See previous post... https://groups.google.com/forum/?hl=en#!topic/comp.lang.idl- pvwave/XNn-lBi9DGQ cheers, greg
creator: greg.addr
date: 2016-04-15T14:01:31-00:00

Re: do loop
type: item
description: If you really need the index names, use (ordered) hash variable: You can use it as normal variables and also loop thru this IDL>dep = findgen(1,500) IDL>col = orderedhash() IDL>for i=0, 9 do $ IDL> col[string(i,form='(i1.1)')+'1'] = dep[0,(i*50):((i+1)*50)-1] IDL> foreach values, col, name do print,name IDL> help,col['31'] IDL> print,col['51'] A.
creator: tonyhey
date: 2016-04-21T15:48:45-00:00