Post Reply 
User Variables
03-06-2014, 03:14 AM (This post was last modified: 03-06-2014 03:22 AM by Han.)
Post: #2
RE: User Variables
(03-05-2014 08:44 PM)veeblefester Wrote:  Is there a line of code that will create a USER VARIABLE from within a program?

I have tried many variations.

Thanks in advance for any help.

If you don't care that it is a CAS variable, then yes.
Code:

EXPORT MAKEVAR(string)
BEGIN
  string:=string+":=0;";
  CAS(string);
END;

Usage: MAKEVAR("var1") -- creates a CAS variable named var1 with an initial value of 0. Some caveats: even though a CAS variable is global, the program will not know about it until it gets created (i.e. it presumably does not exist during compilation). So you will need to be careful with your code -- but indirection would be fine.

And now for a small digression...

A CAS variable is much more versatile. You can even use it in the solver app. This means you can create your own equation library program that dynamically creates variables without actually having to predefine them, despite what many previous posts seem to suggest. And when you're done, you can purge them with the purge() command.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
User Variables - veeblefester - 03-05-2014, 08:44 PM
RE: User Variables - Han - 03-06-2014 03:14 AM
RE: User Variables - veeblefester - 03-06-2014, 12:01 PM



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