| T O P I C R E V I E W |
| celarson |
Posted - 06/12/2003 : 2:06:20 PM Yet another basic question.
What is the labtalk command to graph a simple function on an existing plot?
This would be the equivalent to the menu selection of Graph->Add Function Graph
I want to plot that same function on every open plot window which I assume I can accomplish with the "doc" command.
Just digging into LabTalk and working my way up the learning curve. Help/hints appreciated.
-carl |
| 2 L A T E S T R E P L I E S (Newest First) |
| celarson |
Posted - 06/13/2003 : 12:25:01 AM Mike, again my thanks. Very helpful and more to the point - you taught me more than I asked. Appreciate the time you took to answer the post - I've already incorporated NewFunction into my script and all is well.
Now on to the next challenge ...
-carl |
| Mike Buess |
Posted - 06/12/2003 : 3:34:05 PM Hi Carl,
To find out what the Add Function Graph command does...
> Open the script window. > Press Ctrl+Shift and select Graph->Add Function Graph
In my Origin 7 SR4 the following shows up in the script window...
Menu id=36120 NewFunction
So one way to run the command is with
menu -e 36120;
That works fine, but menu IDs can change from one version to the next. A more reliable way is to execute the command itself: NewFunction. The syntax for running a section in a script file is run.section(File,SectionName), so NewFunction must either be a macro or an Origin C function. If you open the Programming Guide, go to the Index and type in NewFunction an entry for the NewFunction macro shows up with this definition...
Def NewFunction { doc -cs F;%B=F$(count+1);create %B -f 10; def ErrorProc [del %B];set %B;del -m ErrorProc; };
doc -cs F;// count the number of datasets with names beginning in F. result is saved in the variable count. %B=F$(count+1); // create a new function name create %B -f 10; // create a new function with that name and give it 10 rows def ErrorProc {del %B}; // what to do if the next command results in a command error. (delete the function.) set %B; // open the plot details dialog for the function del -m ErrorProc; // clean up
You can use the NewFunction macro in you labtalk script or just use the particular commands that are appropriate for what you want to do.
Hope that helps.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 06/12/2003 3:37:50 PM |