clearin

clearin('caller', 'varname1') removes variable varname1 from the workspace of the caller function.

Examples

>> x = 1
y = 2
z = 3

[x:1]
[y:2]
[z:3]

>> fun1 

% with fun1.m % function [] = fun1 % clearin('caller', 'x') % end

>> x undefined function or variable "x" - line 1 >> fun2

% with fun2.m % function [] = fun2 % clearin('caller', {'y','z'}) % end

>> y undefined function or variable "y" - line 1 >> z undefined function or variable "z" - line 1

See also

clc | whos