
Prompting and Inserting Values

astrotool
I want to do this so when I prompt for the values it will put in the 0.2, 0.5, and 0.8, that I type into the prompt, into this code:
Function RawGraphing(CCNNumberAll, TimeAll, CurrentSSAll) wave CCNNumberAll, TimeAll, CurrentSSAll Extract CCNNumberAll, ccnss1, CurrentSSAll == 0.2 Extract TimeAll, timess1, CurrentSSAll == 0.2 Extract CCNNumberAll, ccnss2, CurrentSSAll == 0.5 Extract TimeAll, timess25, CurrentSSAll == 0.5 Extract CCNNumberAll, ccnss3, CurrentSSAll == 0.8 Extract TimeAll, timess3, CurrentSSAll == 0.8 End
and it will put in the values when I run
Legend/C/N=text0/J/H={0,5,10}/E=2 "\\s(ccnss1) SS=0.2%\r\\s(ccnss2) SS=0.5%\r\\s(ccnss3) SS=0.8%"
Do I prompt for a couple of values, and then assign them to seperate symbols or something so that I then type in SS="ASSIGNMENT"% or CurrentSSAll == "ASSIGNMENT" when writing procedures?
Now to figure out how to put it places when I need it like in the textbox so SS="u"%, or CurrentSSAll == "v"
May 28, 2008 at 02:29 pm - Permalink
Prompt
statement is where the value the user enters will be stored. So, in this code you gave earlier:the default value of variable u that the user will see when the prompt is displayed will be 0.2. After DoPrompt is called, if the user changes that value then the new value will be reflected in variable u.
In later code you can just use the variables in statements as you would use any other variables. If you want the values to be placed into a text box, I'd recommend that you use the sprintf operation to build the string you'll then place in a text box or legend. So, as an example, you might do something like this:
You should read the command help for the sprintf and printf operations for information on what the various replacement codes (such as %f which is used in my example) mean.
May 28, 2008 at 02:33 pm - Permalink
When I try and enter in the variable to this code
It does not work properly and returns empty tables
May 28, 2008 at 02:56 pm - Permalink
Either pass x into the function ...
... or get x within the function ...
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
May 29, 2008 at 04:54 am - Permalink
May 29, 2008 at 01:12 pm - Permalink
In the meantime, in response to your question about using something such as ...
... this should work as long as all the waves (source, dest, testwave, valuewave) exist before this line of code is reached.
As for setting variables to be permanent, you want to declare them to be global using the /G flag ...
Use this function. Then, on the command line, execute the following:
Check the data browser to see where xv is located.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
May 29, 2008 at 01:15 pm - Permalink
I just didn't want to make two prompts, but it really doesn't matter.
I wanted to have it so I could have a function prompt for values at the beginning, then store them, then later on use them in expressions as values. I tried tons of ways of calling them but to no avail. Thanks for the global variable, I will give that a try
I appreciate all your help, I know I have been a pain :-)
May 29, 2008 at 01:17 pm - Permalink
This helps me understand better why your questions seem to be ... jumbled.
You have two tasks, GET+STORE values and USE values. Write two functions (using globally defined and accessed variables):
Once you have each of these functions working properly by themselves, then you can use them together ...
Rather a bit confusing ... certainly not a pain. I suggest, as time permits, you might want to read a book on the basics of programming in a language such as C, javascript (not java), or basic (not visual basic).
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
May 29, 2008 at 01:39 pm - Permalink
Also, I'd recommend that you take a look at the well written Programming.ihf file that comes with Igor. I'd execute:
from the Igor command line and start from there.
May 30, 2008 at 05:37 am - Permalink
sprintf tbString, "\\s(ccnss1) SS=%f%\r\\s(ccnss2) SS=%f%\r\\s(ccnss3) SS=%f%", u, v, x
Legend/C/N=text0/J/H={0,5,10}/E=2 tbString
Can someone explain to me how the '\\s' is this code works and what it does, why its needed? Thanks.
ssmith
October 18, 2017 at 02:04 pm - Permalink
That double backslash is required to make a single backslash in the final textbox text.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
October 18, 2017 at 02:13 pm - Permalink