Procedural variables

Procedural variables - Mensajes

#1 Publicado: 6/7/2023 23:12:48
Lupus the Canine

Lupus the Canine

0 me gusta en 7 mensajes.

Grupo: User

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:
Zrzut ekranu 2023-07-07 041452.png
example.sm (4,39 KiB) descargado 1429 vez(es).?
#2 Publicado: 7/7/2023 5:06:15
Davide Carpi

Davide Carpi

1.443 me gusta en 2.936 mensajes.

Grupo: Moderator

That's one of the other options.

2023-07-07 10_05_43-SMath Solver - [example.sm_].png
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Publicado: 7/7/2023 16:18:37
Lupus the Canine

Lupus the Canine

0 me gusta en 7 mensajes.

Grupo: User

Wrote

That's one of the other options.

2023-07-07 10_05_43-SMath Solver - [example.sm_].png



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 Publicado: 7/7/2023 20:02:53
Martin Kraska

Martin Kraska

1.361 me gusta en 2.275 mensajes.

Grupo: Moderator

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,31 KiB) descargado 1459 vez(es).
asg.png
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
#5 Publicado: 7/7/2023 23:52:52
overlord

overlord

600 me gusta en 1.381 mensajes.

Grupo: Moderator

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.


Something like this?
z can be anything and come from anywhere.
As long as it has same length with v.

Regards

StrAssign.sm (6,91 KiB) descargado 1413 vez(es).

Click to enlarge
#6 Publicado: 8/7/2023 17:48:00
Lupus the Canine

Lupus the Canine

0 me gusta en 7 mensajes.

Grupo: User

Thank you for your help makraska and overlord.
This look great. I will throw eval in there to be sure it is numeric assignment.
#7 Publicado: 10/7/2023 9:53:28
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Wrote

Thanks, 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,74 KiB) descargado 1460 vez(es).
  • Nuevos mensajes
  • Sin mensajes nuevos