MATLAB: Workspace & GUI

workspace

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!

Best Answer

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');