I am trying to call clear all from a simulink Level 1 S-function. I've take a look over doc mexCallMATLAB
but I do not know how to use it. I've wanted to clear the work space after my function is called.
Asked
Active
Viewed 184 times
0

Alexandru Tat
- 3
- 2
1 Answers
1
Are you sure that you're writing a level-1 S-Function? If you are, then you shouldn't. These days both m-code and c-code S-Functions should all be written as level-2.
You haven't specifically indicated whether you are writing in m-code or c-code, but since you've mentioned mexCallMATLAB
it's assumed that you are using c-code, in which case you should use
mexEvalString("clear('all');");
If you're using m-code, then just use
evalin('base','clear all');

Phil Goddard
- 10,571
- 1
- 16
- 28