1 Pages (7 items)
Procedural variables - Messages
#1 Posted: 7/6/2023 11:12:48 PM
Is it possible to procedurally define variables from strings?
I want to load data to a lot of sets of variables with names following a pattern preferably without doing that manually.
Is there a better way than:

example.sm (4 KiB) downloaded 28 time(s).?
I want to load data to a lot of sets of variables with names following a pattern preferably without doing that manually.
Is there a better way than:
example.sm (4 KiB) downloaded 28 time(s).?
#2 Posted: 7/7/2023 5:06:15 AM
#3 Posted: 7/7/2023 4:18:37 PM
Wrote
Thanks, unfortunately value to be assigned is supposed to come from somewhere else, z was just an example because I didn't want to make example with large vectors or matrices to be assigned.
I was looking for a function that would turn a string into a variable that can be used as lhs operand in assignment.
#4 Posted: 7/7/2023 8:02:53 PM
If the value to be assigned is an ordinary expression, then just convert it to a string before using the above-mentioned methods.
asg.sm (4 KiB) downloaded 26 time(s).

asg.sm (4 KiB) downloaded 26 time(s).
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#5 Posted: 7/7/2023 11:52:52 PM
WroteThanks, unfortunately value to be assigned is supposed to come from somewhere else, z was just an example because I didn't want to make example with large vectors or matrices to be assigned.
Something like this?
z can be anything and come from anywhere.
As long as it has same length with v.
Regards
StrAssign.sm (6 KiB) downloaded 25 time(s).
#6 Posted: 7/8/2023 5:48:00 PM
Thank you for your help makraska and overlord.
This look great. I will throw eval in there to be sure it is numeric assignment.
This look great. I will throw eval in there to be sure it is numeric assignment.
#7 Posted: 7/10/2023 9:53:28 AM
WroteThanks, unfortunately value to be assigned is supposed to come from somewhere else ...
I was looking for a function that would turn a string into a variable that can be used as operand in assignment.
algo(col) will deal with mixed import matrix.
You can code to convert mixed or numeric or string.
Select the desired matrix-col.
Subsequently, set your maths.
The attached document SS 6179, I checked it opens 30405.
Please, confirm it opens on your system.
Cheers ... Jean.
Maths Convert-str2num COL algo.sm (5 KiB) downloaded 34 time(s).
1 Pages (7 items)
-
New Posts
-
No New Posts