Post Reply 
Dynamic Variable(s)....Help??
11-21-2016, 10:49 PM (This post was last modified: 11-21-2016 11:06 PM by toshk.)
Post: #4
RE: Dynamic Variable(s)....Help??
(11-21-2016 06:54 AM)cyrille de brĂ©bisson Wrote:  Hello,

You can create variable dynamically using HVars and AVars, However, in your case here, what you most likely need is the creation of one single variable that will contains an indexable number of variables.

If your data is purely numerical (reals or complex), a matrix will work. Else, you can use a list.

Cyrille
... this is my work around for dynamic variable(s) that exist with their variable names.
with cas: create a dummy variable(s ) with expr, string syntax and assign zero to it. then use these dummy(s) which now exist in cas world in home/cas.
example is provided below...in my circuit case I know the number of node(s) hence create v1, v2....vn. I also know the paths hence I can create potential difference label as v1v2, v3v4.....and for current create j1j2, j3j4.....
a modification of this code dumber() with arguments can be tailored to ones need for special variables in Solver app; equation Library and etc.

#cas
dumber() //creating 10 dummy variables of f and vnvn
BEGIN
local k, ss;
FOR k FROM 1 TO 10 DO
ss:=left(STRING(k),10);
expr("f" +ss +":=" +0); //dummy f1,f2....f10
expr("v" +ss +v + ss +":=" +0); //dummy v1v1, v2v2....v10v10
END;
END;
#end
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Dynamic Variable(s)....Help?? - toshk - 11-18-2016, 05:36 PM
RE: Dynamic Variable(s)....Help?? - Jan_D - 11-20-2016, 05:49 PM
RE: Dynamic Variable(s)....Help?? - toshk - 11-21-2016 10:49 PM
RE: Dynamic Variable(s)....Help?? - toshk - 11-21-2016, 11:31 PM
RE: Dynamic Variable(s)....Help?? - toshk - 11-22-2016, 04:28 PM
RE: Dynamic Variable(s)....Help?? - Jan_D - 11-22-2016, 05:54 PM
RE: Dynamic Variable(s)....Help?? - toshk - 11-22-2016, 05:07 PM



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