Remove parameter from workspace

조회 수: 8 (최근 30일)
Diana Acreala
Diana Acreala 2012년 3월 30일
Hey!
I need to remove a parameter from workspace.. the parameter name is saved in a variable 'param_name' which is of course also in workspace. At a given moment I need to remove this parameter, but I can refer to it only by using my variable 'param_name'. How is this possible? I tried clearvars param_name but everybody knows that the result of this will be the removing of the variable 'param_name'.
Thanks! Diana

채택된 답변

Rick Rosson
Rick Rosson 2012년 3월 30일
Use functional syntax
clearvars(param_name);
instead of command syntax.
  댓글 수: 1
Diana Acreala
Diana Acreala 2012년 3월 30일
Thanks! I appreciate your help!

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

추가 답변 (1개)

Diana Acreala
Diana Acreala 2012년 4월 2일
And I got stuck... functions do not share the same workspace..
In my app I need to select a variable (which contains the name of a parameter from workspace) from a listbox (I sent this variable in workspace using assignin) and next I want to change the parameter name. After changing the name I want to delete from workspace the parameter which name is contained in the selected variable. All these steps are done in different functions. In my ChangeParameterName workspace function I don't have that parameter saved.
Is possible somehow to search in all "workspaces" that I have, from each function, and delete my parameter directly in this function where I change the name? Even if in this workspace ChangeParameterName function my parameter is not appearing?
  댓글 수: 1
Diana Acreala
Diana Acreala 2012년 4월 2일
Solved the problem:
evalin('base',['clear ',(VarName)])
This is what I used, where VarName contains the name of the parameter desired to be deleted

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

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by