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

Home » Public Forums » archive » For..Do loop. IDL Beginner
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: For..Do loop. IDL Beginner [message #93793 is a reply to message #93792] Tue, 18 October 2016 02:39 Go to previous messageGo to previous message
Nikola is currently offline  Nikola
Messages: 53
Registered: November 2009
Member
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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Fitting plasma waveforms with 10^6 variable combos!
Next Topic: smooth() bug in (at least) version 8.5.1

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

Current Time: Wed Oct 08 20:07:38 PDT 2025

Total time taken to generate the page: 0.62467 seconds