Why do I get an error message when I try to close the Simulink 7.1 (R2008a) Library Browser?

2 次查看(过去 30 天)
In my application, I would like to close the Simulink Library Browser unconditionally, irrespective of whether it was open or not.
I used to use
simulink('close');
to close the library, even if it is not open at all during the current MATLAB session. It used to work just fine until R2008a,where I receive the following error if the Simulink library is never opened:
Error: Simulink Library Browser is not open
The interesting thing is that, if during the current MATLAB session the Simulink library has been opened and closed, calling the above command will no longer yield an error.
How can I workaround this error message?

采纳的回答

MathWorks Support Team
The message 'Error: Simulink Library Browser is not open' you get when attempting to do Simulink('Close') for the first time, is simply a display message. This message will not stop the execution of any commands you may have after Simulink('Close') in your script.
While it might be difficult to determine if the Simulink Library Browser was opened anytime before in the current session, you can use the following workaround to unconditionally close the Library Browser:
lb = LibraryBrowser.StandaloneBrowser; %get an handle to the library browser
lb.hide %hide the browser irrespective of whether it is open or not

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programmatic Model Editing 的更多信息

产品


版本

R2008a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by