Post Reply 
recall a var that has a space in its name
08-27-2019, 01:21 AM
Post: #1
recall a var that has a space in its name
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 ..
Find all posts by this user
Quote this message in a reply
08-27-2019, 06:56 AM (This post was last modified: 08-27-2019 07:05 AM by Joe Horn.)
Post: #2
RE: recall a var that has a space in its name
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.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
08-27-2019, 07:38 AM
Post: #3
RE: recall a var that has a space in its name
(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.

There are only 10 types of people in this world. Those who understand binary and those who don't.
Find all posts by this user
Quote this message in a reply
08-27-2019, 11:22 AM
Post: #4
RE: recall a var that has a space in its name
(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?

Flag -86.

Huh, I never knew about that! I always just included "256. ATTACH" (among other things) in my STARTUP.
Visit this user's website Find all posts by this user
Quote this message in a reply
08-28-2019, 01:00 AM
Post: #5
RE: recall a var that has a space in its name
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 ..
Find all posts by this user
Quote this message in a reply
08-28-2019, 01:54 AM (This post was last modified: 08-28-2019 01:59 AM by Joe Horn.)
Post: #6
RE: recall a var that has a space in its name
(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?

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
08-28-2019, 04:27 AM (This post was last modified: 08-28-2019 04:28 AM by b17flyboy.)
Post: #7
RE: recall a var that has a space in its name
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 ..
Find all posts by this user
Quote this message in a reply
08-28-2019, 05:11 AM
Post: #8
RE: recall a var that has a space in its name
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 ..
Find all posts by this user
Quote this message in a reply
08-28-2019, 12:05 PM
Post: #9
RE: recall a var that has a space in its name
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.
Visit this user's website Find all posts by this user
Quote this message in a reply
08-28-2019, 12:28 PM
Post: #10
RE: recall a var that has a space in its name
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 ...
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)