remove all declared variables

remove all declared variables - is there any function to remove all declared variables? similar to clear - Messages

#1 Posted: 9/29/2021 11:59:19 PM
JOSEPH7

JOSEPH7

0 likes in 1 posts.

Group: User

Help!

is there any function to remove all declared variables? similar to clear
#2 Posted: 10/1/2021 6:45:30 PM
Oscar Campo

Oscar Campo

124 likes in 298 posts.

Group: Moderator

Wrote

Help!

is there any function to remove all declared variables? similar to clear



You can install the "Special Functions" plugin, which has a Clear() function as you need.

1 users liked this post
Andrey Ivashov 10/1/2021 6:49:00 PM
#3 Posted: 10/1/2021 6:51:47 PM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3729 posts.

Group: Super Administrator

Wrote

You can install the "Special Functions" plugin, which has a Clear() function as you need.


Actually this plug-in is built-in into the installer package.

ClearFunc_1.png
1 users liked this post
Oscar Campo 10/2/2021 2:58:00 AM
#4 Posted: 10/2/2021 11:36:43 AM
overlord

overlord

547 likes in 1330 posts.

Group: Moderator

If SMath would allow to clear variables inside a matrix,
that would be an answer for your request.
But it does not, so this is a dead-end.

2021-10-02_17-31.png

For now, you have to make all your variables an element of vector/matrix,
if you want to clear all of them in single command.
Or manually clear them one by one.

2021-10-02_17-34.png

Regards
#5 Posted: 10/16/2021 3:08:40 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Wrote

Help!

is there any function to remove all declared variables? similar to clear



Hi. I think what the user request is a function similar to "clear all" in Matlab.
Given that include is capable of collecting all the names of the variables of a worksheet as the "whos" command of Matlab would do, perhaps the include code can be used to implement the option to delete all the variables with Clear( "all" ) or something similar.

Imagen1.png

Best regards
Alvaro.
#6 Posted: 10/17/2021 7:41:24 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

is there any function to remove all declared variables? similar to Clear


Clear(■,■,■,■,■) ...
clears the system in cause [variables, vectors, matrices]
Clear(x,y,z,m,ω)=1 are evaporated from the system.

Page17 Clear.sm (15 KiB) downloaded 46 time(s).
#7 Posted: 10/17/2021 12:27:54 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

is there any function to remove all declared variables? similar to clear


remove ... you mean clear for reuse ?
Option Find [Ctrl+F] finds numerical single value,
it takes only one search at time, greek not from
palette but copied from palette
Does not distinguish math regions from text.
Not much use for Find.
If the letter is a vector just ignored.
#8 Posted: 10/17/2021 2:29:26 PM
overlord

overlord

547 likes in 1330 posts.

Group: Moderator

Wrote

Hi. I think what the user request is a function similar to "clear all" in Matlab.


Yes Razonar, probably that is the OP's request.
He doesn't want to write every variable into Clear().
Just Clear(ALL) and puff, all defined shall be cleared.

Regards
#9 Posted: 5/27/2023 4:25:38 PM
OlliL

OlliL

0 likes in 3 posts.

Group: User

Hi, sorry to resurrect the thread, just chiming in to say that I would really love a Clear(ALL) function too.
Often it would be nice to use a one SMath file to make multiple repeat calculations but not being able to clear the variables makes repeat calculations extremely risky.
#10 Posted: 5/27/2023 9:17:00 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

is there any function to remove all declared variables? similar to clear


The Clear(All) will not clear matrix/vector that are not resident (isolated).
Fromm observation, in that case, set XY the matrix XY:=0
That clears the global system calculation.

#11 Posted: 5/28/2023 9:12:56 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

is there any function to remove all declared variables? similar to Clear


Not all variables/parameters are declared.
Many reside @ the kernel level, not recognized by Clear(,,,)=
I have an instance that can't be renewed by Clear(,,,)=
#12 Posted: 6/6/2023 2:06:54 AM
OlliL

OlliL

0 likes in 3 posts.

Group: User

Wrote

Wrote

is there any function to remove all declared variables? similar to Clear


Not all variables/parameters are declared.
Many reside @ the kernel level, not recognized by Clear(,,,)=
I have an instance that can't be renewed by Clear(,,,)=



Good morning!
So there is a Clear(All) function? How is it used?
#13 Posted: 6/6/2023 11:27:27 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

So there is a Clear(All) function ?
How is it used ?


AFAIK, there is no Clear(All) ... what is All ?
Clear(,,,) also restores the built-in.
Cheers ... Jean.

Maths Clear Restore.sm (9 KiB) downloaded 33 time(s).

#14 Posted: 10/6/2023 3:50:47 AM
rkronhofer

rkronhofer

0 likes in 1 posts.

Group: User

Hy,

is there any update on such a "Clear(All)" function?

Would be really helpful to have it like this

a:=5
b:=6

Clear(All):=1

a=?
b=?

Thanks for answers

BG

SMath_ClearAll.png
#15 Posted: 10/6/2023 1:31:53 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Often it would be nice to use a one SMath file to make multiple repeat calculations but not being able to clear the variables makes repeat calculations extremely risky.


Build your system algo style complete wrt parameters
Collapse in utilities, top document.
Now, you are in-situ command line mode ...
Nothing to clear. Just plug parameters in each command line.
#16 Posted: 10/8/2023 1:55:30 PM
overlord

overlord

547 likes in 1330 posts.

Group: Moderator

Wrote

So there is a Clear(All) function?


There is not a Clear(All) function.
No method is applicable to remove all variables at once.

Wrote

is there any update on such a "Clear(All)" function?


There is not an update, yet.
Unfortunately, I guess none shall appear on horizon soon.

Regards
#17 Posted: 10/9/2023 6:45:04 AM
Davide Carpi

Davide Carpi

1415 likes in 2872 posts.

Group: Moderator

CustomFunctions plugin

ClearAll.png

direct link: link removed (now the extensions manager works again)
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
3 users liked this post
Oscar Campo 10/9/2023 7:38:00 AM, Arie 10/9/2023 10:58:00 AM, overlord 10/9/2023 6:20:00 PM
#18 Posted: 10/9/2023 6:23:22 PM
overlord

overlord

547 likes in 1330 posts.

Group: Moderator

This works!!!
Thanks for the beta update.

What would you think about revising output string?
Instead of "1", it can be;
arg==1 --> "All cleared"
arg==2 --> "Variables cleared"
arg==3 --> "Functions cleared"

Regards
1 users liked this post
Oscar Campo 10/9/2023 8:25:00 PM
#19 Posted: 10/10/2023 11:54:52 AM
Davide Carpi

Davide Carpi

1415 likes in 2872 posts.

Group: Moderator

Wrote

This works!!!
Thanks for the beta update.


You're welcome, glad it seems to work correctly on first try. I still have to check carefully the (2)nd option, since as it is now it deletes "anything that is not a function" (including some low-level stuff).

Wrote

What would you think about revising output string?
Instead of "1", it can be;
arg==1 --> "All cleared"
arg==2 --> "Variables cleared"
arg==3 --> "Functions cleared"


Usually I prefer a binary output, since can be used inside if/else functions independently from localizations, future enhancements of descriptions, and string comparision issues.
I'll think about it.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#20 Posted: 10/11/2023 3:49:18 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

is there any function to remove all declared variables? similar to clear


If you have discretized [x,y,z ...] in part 1 of project
as that part 1 is complete ... Clear(x,y,z) for next part of the project.
Assume part 1 & part 2 are constructed around 5 parameters.
If you ClearAll(,,,,,) past part 1
You have to re-install those 5 parameters that over-ride
themselves from the new ones.

  • New Posts New Posts
  • No New Posts No New Posts