Append the loaded waves to the top Graph

I am trying to learn Igor programming (too hard :-( ) and I just started to create functions. I would like to know how we can Append the loaded waves to the top wave (which I created earlier) ? I made this simple function but it does not work unless I put in the header of the file I want to load the word "Decay"


#pragma rtGlobals=1		// Use modern global access method.

Function LoadGraph()

Make/O/N=4090/D 'Decay'
Display/M/W= (22,1.5,33.5,9.5); AppendToGraph 'Decay' 
DoWindow/F Graph0
LoadWave/O/G/W/A
SetScale/I x 0,200,"ns", Decay 

End


PS: Is there a recommended method to learn Igor programming -_-' ?
Decay.txt (16.5 KB)
First, create the graph manually with nothing in it by executing:

Display

from the command line.

Now here is a function that will load a file and append to the top graph:

Function LoadGraph()
	DoWindow/F Graph0
	LoadWave/O/G/A
	if (V_flag == 0)		// V_flag is set by LoadWave
		return -1		// User cancelled - -1 signifies cancel
	endif
	String name = StringFromList(0, S_waveNames)	// S_waveNames is set by LoadWave
	Wave w = $name		// Get a wave reference for the loaded wave
	SetScale/I x 0,200,"ns", w	// Set wave's X scaling
	AppendToGraph w		// Append to top graph
	return 0				// Zero-signifies success 
End


To learn more execute this:

DisplayHelpTopic "Loading Waves Using Igor Procedures"


Is there a recommended method to learn Igor programming

First, if you have not already done it, do the Igor guided tour by choosing Help->Getting Started. This is a prerequisite.

Next read these chapters in the PDF manual:
IV-1: Working With Commands
IV-2: Programming Overview
IV-3: User-Defined Functions
IV-5: User-Defined Menus
IV-6: Interacting With The User

Thank you very much hordstein, but the SetScale does not work! and I do not understand all ° _ ° ' This is really hard.
No I have not yet read the Igor's manul....

fay.tor wrote: Thank you very much hordstein, but the SetScale does not work! and I do not understand all ° _ ° ' This is really hard.
No I have not yet read the Igor's manul....

Unless you at least go through the Guided Tour and understand Igor's "wave scaling", you will be wasting a lot of time just trying stuff that doesn't work.

Choose "Getting Started" from Igor's Help menu, start with "Introduction to Igor Pro", continue through "Waves - The Key Igor Concept". You *could* try skipping to the "User-Defined Functions" help topic, but Howard's suggested reading list is more likely to lead to success.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.
you're right Jim, I want to skip ahead to go faster but obviously this is not the right way ...