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

For..Do loop. IDL Beginner
type: item
description: Hi, I am trying to plot the following using For.. Do loop. i. x, y2 ; psym = -4 ii. x, y3 ; psym = -5 iii. x, y4; psym = -6 Can anyone help? Thanks
creator: smnadoum
date: 2016-10-17T23:46:29-00:00

Re: For..Do loop. IDL Beginner
type: item
description: On Tuesday, October 18, 2016 at 12:46:43 AM UTC+1, Cheryl wrote: > Hi, > > I am trying to plot the following using For.. Do loop. > > i. x, y2 ; psym = -4 > ii. x, y3 ; psym = -5 > iii. x, y4; psym = -6 > > Can anyone help? Thanks From your question is not very clear what you want to do and why. I guess your problem is that y's are different functions with different number of elements so that you have to deal with different variable names in a loop. Here is a quick solution that may help you to move forward. (Note that the EXECUTE command should be used with extra caution - read IDL help on it!.) syms = [-4, -5, -6] for i = 0, N_ELEMENTS(syms)-1 DO BEGIN IF i eq 0 THEN cmd = 'plot' ELSE cmd = 'oplot' log = EXECUTE(cmd + ', x, y'+strcompress(string(i), /rem)+', psym = syms[i]') ENDFOR
creator: Nikola
date: 2016-10-18T09:39:16-00:00

Re: For..Do loop. IDL Beginner
type: item
description: On 10/18/2016 11:39 AM, Nikola Vitas wrote: > On Tuesday, October 18, 2016 at 12:46:43 AM UTC+1, Cheryl wrote: >> I am trying to plot the following using For.. Do loop. >> >> i. x, y2 ; psym = -4 >> ii. x, y3 ; psym = -5 >> iii. x, y4; psym = -6 > From your question is not very clear what you want to do and why. I > guess your problem is that y's are different functions with different > number of elements so that you have to deal with different variable > names in a loop. > > Here is a quick solution that may help you to move forward. (Note > that the EXECUTE command should be used with extra caution - read IDL > help on it!.) > > syms = [-4, -5, -6] > for i = 0, N_ELEMENTS(syms)-1 DO BEGIN > IF i eq 0 THEN cmd = 'plot' ELSE cmd = 'oplot' > log = EXECUTE(cmd + ', x, y'+strcompress(string(i), /rem)+', psym = syms[i]') > ENDFOR easiest is g=plot(x, y2, psym = -4) void=plot(x, y3, psym = -5, overplot=g) void=plot(x, y4, psym = -6, overplot=g) if it needs to be a loop, eighter use EXECUTE, or p=ptrarr(3) *p[0]=y2 *p[1]=y3 *p[2]=y4 g=!null for i=0,2 do g=plot(x,*p[i],psym=-3-i,overplot=g) You probably could use a LIST or another data type as well instead of pointers, if you prefer.
creator: Markus Schmassmann
date: 2016-10-18T10:50:33-00:00

Re: For..Do loop. IDL Beginner
type: item
description: On Tuesday, October 18, 2016 at 5:39:23 AM UTC-4, Nikola Vitas wrote: > Here is a quick solution that may help you to move forward. (Note that the EXECUTE command should be used with extra caution - read IDL help on it!.) > I think you are missing the point. I seems that it is the OP's intent to avoid reading ANY IDL help or documentation and have the newsgroup solve all course exercises.
creator: Haje Korth
date: 2016-10-18T11:27:58-00:00

Re: For..Do loop. IDL Beginner
type: item
description: On Tuesday, October 18, 2016 at 4:28:00 AM UTC-7, Haje Korth wrote: > On Tuesday, October 18, 2016 at 5:39:23 AM UTC-4, Nikola Vitas wrote: >> Here is a quick solution that may help you to move forward. (Note that the EXECUTE command should be used with extra caution - read IDL help on it!.) >> > > I think you are missing the point. I seems that it is the OP's intent to avoid reading ANY IDL help or documentation and have the newsgroup solve all course exercises. Hi Haje, you are right, it is a course exercise for a course that I am actually not taking, this is basically an exercise that I am working on to learn IDL. I am only looking for help because I feel like I am stuck and don't know how to solve these IDL problems. I do have a couple of books that I am reading and when I don't find the answer I look online. You don't have to help if you don't want to. and instead of wasting 5 min of your time writing that comment, you couldve just ignored it if it bothers you this much. please don't make any judgement from behind the monitor.
creator: smnadoum
date: 2016-10-27T21:27:47-00:00

Re: For..Do loop. IDL Beginner
type: item
description: On Thursday, October 27, 2016 at 5:28:01 PM UTC-4, Cheryl wrote: > On Tuesday, October 18, 2016 at 4:28:00 AM UTC-7, Haje Korth wrote: >> On Tuesday, October 18, 2016 at 5:39:23 AM UTC-4, Nikola Vitas wrote: >>> Here is a quick solution that may help you to move forward. (Note that the EXECUTE command should be used with extra caution - read IDL help on it!.) >>> >> >> I think you are missing the point. I seems that it is the OP's intent to avoid reading ANY IDL help or documentation and have the newsgroup solve all course exercises. > > Hi Haje, > > you are right, it is a course exercise for a course that I am actually not taking, this is basically an exercise that I am working on to learn IDL. I am only looking for help because I feel like I am stuck and don't know how to solve these IDL problems. I do have a couple of books that I am reading and when I don't find the answer I look online. You don't have to help if you don't want to. and instead of wasting 5 min of your time writing that comment, you couldve just ignored it if it bothers you this much. > please don't make any judgement from behind the monitor. ; using direct graphics: syms =[-4, -5, -6 ] x = findgen(100) y2 = x y3 = x/3 y4 = x/4 y = [[y2], [y3], [y4]] plot, x, y[*,0], psym=syms[0] for i = 1, 2 do oplot, x, y[*,i], psym=syms[i]
creator: Bill Davis
date: 2016-12-07T20:23:11-00:00