recall a var that has a space in its name - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: recall a var that has a space in its name (/thread-13517.html) |
recall a var that has a space in its name - b17flyboy - 08-27-2019 01:21 AM Hello, I was testing the variety of variable names that I can create on the HP50G. I managed to create a var called 'dB VOLTS'. I can view it with the FILES app and even rename it inside the FILES app. However I am having problems trying to use it. Now I don't normally write code with space in var names, but I am curious if anyone has had experience using them in say UserRPL programs. Is there some escaping mechanism that makes this possible, or do I put it in the "you can create it, but you can't use it basket" ? Cheers .. RE: recall a var that has a space in its name - Joe Horn - 08-27-2019 06:56 AM One way to create strange variable names is by typing them as strings (e.g. "dB Volts") and then executing the S~N command which converts any string into a name or vice versa. Library 256 is built in but normally not attached, so if typing S~N doesn't work, that means that Library 256 isn't attached in your 50g, in which case you can still execute S~N by executing 256.04 MENU, then pressing the S~N soft key (F5). There's a system flag which, if set, forces Library 256 to be attached at every warmstart. Anybody remember which flag that is? It's a good idea to set that flag, since it lets you easily use Library 256's very powerful commands in your programs. EDIT: In case it isn't obvious, one way to include the name object 'dB Volts' in a program is "dB Volts" S~N, which doesn't put it literally into the program but does put it on the stack when the program runs, which is the actual goal anyhow. RE: recall a var that has a space in its name - grsbanks - 08-27-2019 07:38 AM (08-27-2019 06:56 AM)Joe Horn Wrote: There's a system flag which, if set, forces Library 256 to be attached at every warmstart. Anybody remember which flag that is? Flag -86. RE: recall a var that has a space in its name - Dave Britten - 08-27-2019 11:22 AM (08-27-2019 07:38 AM)grsbanks Wrote:(08-27-2019 06:56 AM)Joe Horn Wrote: There's a system flag which, if set, forces Library 256 to be attached at every warmstart. Anybody remember which flag that is? Huh, I never knew about that! I always just included "256. ATTACH" (among other things) in my STARTUP. RE: recall a var that has a space in its name - b17flyboy - 08-28-2019 01:00 AM Hi, Thanks Joe et al for the information. I used "dB VOLTS" S~N to get 'dB VOLTS' onto the stack but things like RCL did not like the argument (invalid syntax). Anyway I learnt about S~N. Cheers .. RE: recall a var that has a space in its name - Joe Horn - 08-28-2019 01:54 AM (08-28-2019 01:00 AM)b17flyboy Wrote: Thanks Joe et al for the information. I used "dB VOLTS" S~N to get 'dB VOLTS' onto the stack but things like RCL did not like the argument (invalid syntax). Anyway I learnt about S~N. Something is strange here. RCL never gives an "Invalid Syntax" error. If RCL gives an "Undefined Name" error, that means that no variable with that name exists in the current path. If a variable called 'dB VOLTS' does exist, then RCL will recall it. Note that attempting to put that variable name on the command line will cause a syntax error, but USING that name object (on the stack) as the argument for RCL should work just fine. What exactly did you do which caused the error (keystrokes, please), and what is the entire error message which appeared on your 50g's screen? RE: recall a var that has a space in its name - b17flyboy - 08-28-2019 04:27 AM Hi Joe, The var is from PEQUM equation I may have written in the past. If I view the var in FILES app it shows. EQ dB VOLTS ALG 43 When I view it in the FILES app it says. GAINdB=20xLOG(V/Vref) with "x" replaced by a dot for multiplication When I press the VAR key and then press the F1 button below the "dB VOLTS" variable it displays the GAINdB formula correctly as shown above. When i do 'dB VOLTS' RCL it replies "Invalid Syntax" with the VOLTS part of "dB VOLTS" highlighted. Cheers .. RE: recall a var that has a space in its name - b17flyboy - 08-28-2019 05:11 AM a little more investigation ... I also made a copy of the var and called it 'dBVOLTS", ie without a space in the name. 'dbVOLTS' RCL works. However I got thinking how the commands are parsed, so I did the following. 'dBVOLTS' ENTER -----> equation is shown 'dB VOLTS' ENTER ------> Invalid syntax So, the RCL may be red herring. The Invalid Syntax occurs without RCL for the 'dB VOLTS' case. Cheers .. RE: recall a var that has a space in its name - SammysHP - 08-28-2019 12:05 PM Where is the S~N in your examples? First you have to put the name on the stack by typing "dB VOLTS' (with double quotes), then put it on the stack with Enter. Next press S~N from the menu. Finally press RCL to recall the value. RE: recall a var that has a space in its name - b17flyboy - 08-28-2019 12:28 PM Well I am glad you all persisted in asking questions. Somewhere along the line I went from using S~N to just entering ' then pressing the F key below the var to auto populate. That was my mistake. So, yes indeed the following is working "dB VOLTS" S~N RCL Appreciate your patience.. Cheers ... |