How can I clear locked functions from memory?
6 views (last 30 days)
Show older comments
When I start MATLAB and type the following commands at the MATLAB command prompt:
clear functions
inmem
I obtain the following result:
ans =
Empty cell array: 0-by-1
Now if I simulate a model, for example "sf_car", and type the following at MATLAB command prompt:
sim('sf_car')
bdclose all
clear functions
inmem
I recieve the following result while I expect an empty array:
ans =
'simulink\private\slpmloadfunction'
'slsfnagctlr'
'slroot'
'signalselector'
'sigandscopemgr'
'modelrefsiglog'
I want to clear these functions from memory.
Accepted Answer
MathWorks Support Team
on 21 Jan 2010
The functions remain in memory because they are locked. Use the MISLOCKED function to determine if a function is locked. The locked function can be unlocked using the MUNLOCK function.
For example, if the function FISLOCK is a locked function, type the following commands at MATLAB command prompt, to identify and unlock the function:
mislocked 'fislock' %Checks if fislock is locked
munlock 'fislock' % Do this if the reult for the previous command is 1 or true
clear all; clear functions; %Clears unlocked functions from memory
inmem
Now the function fislock will not appear in the result.
The attached file, clearmemory.m can be run to unlock and remove locked function from memory.
NOTE: These functions may be locked in memory for a reason. Unlocking and clearing can cause other issues. Before clearing a function, ensure that it indeed must cleared.
0 Comments
More Answers (0)
See Also
Categories
Find more on Scope Variables and Generate Names in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!