remove all declared variables

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

#1 已发布: 2021/9/29 23:59:19
JOSEPH7

JOSEPH7

0个赞,共1个帖子。

组: User

Help!

is there any function to remove all declared variables? similar to clear
#2 已发布: 2021/10/1 18:45:30
Oscar Campo

Oscar Campo

135个赞,共309个帖子。

组: 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位用户喜欢此帖子
Andrey Ivashov 2021/10/1 18:49:00
#3 已发布: 2021/10/1 18:51:47
Andrey Ivashov

Andrey Ivashov

2,344个赞,共4,057个帖子。

组: 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位用户喜欢此帖子
Oscar Campo 2021/10/2 02:58:00
#4 已发布: 2021/10/2 11:36:43
overlord

overlord

600个赞,共1,381个帖子。

组: 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 已发布: 2021/10/16 15:08:40
Alvaro

Alvaro

1,139个赞,共1,805个帖子。

组: 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 已发布: 2021/10/17 07:41:24
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: 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.52 KiB)已下载 1622 次。
#7 已发布: 2021/10/17 12:27:54
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: 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 已发布: 2021/10/17 14:29:26
overlord

overlord

600个赞,共1,381个帖子。

组: 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 已发布: 2023/5/27 16:25:38
OlliL

OlliL

0个赞,共3个帖子。

组: 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 已发布: 2023/5/27 21:17:00
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: 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 已发布: 2023/5/28 09:12:56
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: 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 已发布: 2023/6/6 02:06:54
OlliL

OlliL

0个赞,共3个帖子。

组: 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 已发布: 2023/6/6 11:27:27
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: 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.14 KiB)已下载 1422 次。

#14 已发布: 2023/10/6 03:50:47
rkronhofer

rkronhofer

0个赞,共1个帖子。

组: 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 已发布: 2023/10/6 13:31:53
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: 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 已发布: 2023/10/8 13:55:30
overlord

overlord

600个赞,共1,381个帖子。

组: 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 已发布: 2023/10/9 06:45:04
Davide Carpi

Davide Carpi

1,443个赞,共2,936个帖子。

组: 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位用户喜欢此帖子
Oscar Campo 2023/10/9 07:38:00, Arie 2023/10/9 10:58:00, overlord 2023/10/9 18:20:00
#18 已发布: 2023/10/9 18:23:22
overlord

overlord

600个赞,共1,381个帖子。

组: 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位用户喜欢此帖子
Oscar Campo 2023/10/9 20:25:00
#19 已发布: 2023/10/10 11:54:52
Davide Carpi

Davide Carpi

1,443个赞,共2,936个帖子。

组: 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 已发布: 2023/10/11 15:49:18
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: 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.

  • 有新帖
  • 无新帖