필터 지우기
필터 지우기

anyway to clear variable in Matlab workspace from app?

조회 수: 57 (최근 30일)
Yu Li
Yu Li 2019년 8월 31일
댓글: Walter Roberson 2023년 4월 19일
Hi:
is there anyway to clear variable in Matlab workspace from app designer?
an workaround I know is to use 'assign' function, to assign an empty value to that variable. but I want know how to clear it.
Thanks!
Yu
  댓글 수: 2
Adam Danz
Adam Danz 2019년 8월 31일
There should be no need to clear variables from any workspace from within a different workspace. If there is a need to do this, it raises red flags that something is being done in a bad way. Could you explain why you need to clear an external workspace?
Adam Danz
Adam Danz 2019년 8월 31일
편집: Adam Danz 2019년 8월 31일
There is rarely a need to clear variables from within a function but sometimes it useful to do so. There should never be a need to clear variables in a different workspace. Without knowing more about what you're doing, the best help I can offer is trying to clean up any reasons why someone would need to do this in the first place.
What workspace is the variable in (the base workspace?), how did it get there, and why does it need to be cleared from within a function (which has its own workspace).

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2019년 8월 31일
evalin('base', 'clear VARIABLENAME')
  댓글 수: 11
Walter Roberson
Walter Roberson 2023년 4월 19일
Please see https://www.mathworks.com/help/matlab/matlab_prog/command-vs-function-syntax.html to get more information about why evalin('base', 'clear app.PLUTODropDown.Value') is not going to work.
Walter Roberson
Walter Roberson 2023년 4월 19일
I would also like to ask you, how can I list in the dropdown the variable that are created within the matlab.app application and not those that are in the base WS?
You can use properties to find the list of variables for the app object.
You will find that in practice most of them should not be eligible for clearing.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

R.G.
R.G. 2019년 8월 31일
To clear variable use 'clear' function instead, ex:
clear('v')
where 'v' is variable name.

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by