The function clearvars
has the instructions presented here.
So say I have a set of variables,
a, b, c, d
and I want to clear these variables except for d I should be able to do this:
clearvars * -except d
but I get the following error:
clearvars * -except d
|
Error: Unexpected MATLAB expression.
What is the reason for this?
This works: clearvars '*' -except d
Matlab must have a problem converting *
into a string when it's on its own. It's fine with both a*
and *a
, but not *
.
Also, this works:
clearvars('*', '-except', 'd')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With