Error: "Undefined variable 'LibraryBrowser' or class 'LibraryBr​owser.Stan​daloneBrow​ser'" after migrating from MATLAB R2012a to R2015b

2 次查看(过去 30 天)
Hello guys,
When using the Simulink Library Browser, I often have to refresh libraries. Luckily, a colleague wrote a nifty callback function which takes care of just that. With Matlab R2012a, the code works just fine. But I ran into the problem mentioned in the title when using the same code with a freshly installed Matlab R2015b.
By googleing the "variable" "LibraryBrowser" I only found a few threads in which the usage of this also recommended. This one, for instance: http://de.mathworks.com/matlabcentral/answers/182922#answer_171182
However, I did not find any explanation or API in which the usage of this is explained or documented.
So my question is, since the usage of this was recommended from multiple sources: Is the variable not supported anymore? Or does anyone has an idea as to why it does not work with the newest version of Matlab?
The code I work with is also responsible for refreshing the current window and does a bit more than that. The callback is designed so it will be executed by pressing "F8" or by clicking "Simulink Library Browser -> View -> Refresh Selected Library"
But by doing so, the error "Undefined variable 'LibraryBrowser' or class 'LibraryBrowser.StandaloneBrowser'" occurs.
This is a part of the code:
function [] = RefreshSelectedLibrary(callbackInfo)
% Callback-function for refreshing the seleceted library.
import System.Text.RegularExpressions.*;
libraryBrowser = LibraryBrowser.StandaloneBrowser; *%breaks here*
%...
% Refresh library browser
libraryBrowser.refreshLibraryBrowser;
% Collapse currrent tree node
currentTreeNode = libraryBrowser.getCurrentTreeNode;
libraryBrowser.collapseTreeNodeByName(currentTreeNode);
% Select and expand library
libraryBrowser.selectTreeNodeByName(selectedTreeItem);
libraryBrowser.expandTreeNodeByName(selectedTreeItem);
end

回答(2 个)

Harvey Ogden
Harvey Ogden 2018-11-20
Was the "above API" replaced with anything in R2015b? How is this function accomplished in R2015b?

Subhadra Mahanti
Subhadra Mahanti 2016-2-8
The above API is deprecated since R2014b.

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by