I’ve toto.m + model.mdl
from a function toto.m , I open model which load variable in workspace
after closing model I want to clear variables loaded in workspace
is there a way to do that without using clear all?
function toto
model = 'model1';
open_system(model1);
close_system(model1);
end
when I run the function the workspace isn’t cleared , how could I clear variable only used by model without using clear all ?
You can use
clearfollowed by a list of variables, for exampleclear a b c. However, I don’t know whether there is a method that clears all the variables declared in a given script, though you can always use functions so all the variables in the scope of the function will be cleared when it ends.