Hi, I have a some data in the workspace which is data1 = <4x4x13 int32).
If I want to clear this from the workspace, I can do so by typing "clear data1" in the command window. However, when I write this into a GUI pushbutton call back, it doesn't do anything.
clear data1;
delete(get(handles.axes1,'children')); % clear axes 1
set(handles.uitable1, 'Data', []); % clears uitable
everything else works (uitable, axes1) but not the workspace!

 채택된 답변

Sean de Wolski
Sean de Wolski 2011년 5월 17일

0 개 추천

That's because it's calling it in the workspace of the callback function, not the base work space. This is what you want:
evalin('base','clear data1');

댓글 수: 3

Jason
Jason 2011년 5월 17일
Thanks, does the same apply for reassigning data in the workspace to another name using the callback.
last = data1
does not work.
Jason
Jason 2011년 5월 17일
Done it:
evalin('base','Last = data1')
Sean de Wolski
Sean de Wolski 2011년 5월 17일
Yes. Use assignin to accomplish that task.
Beware however, this can all be dangerous as you may overwrite/clear something unintentionally.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기

태그

질문:

2011년 5월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by