% Adding Custom Viewers and Generators to the Signal & Scope Manager
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% You can add custom signal viewers so that they appear in the Signal & Scope Manager.
% Taken from the Simulink help files.
%This block is not designed to be ran, but to be read.
% Modified by Jarvis Davis 12/5/05
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The following procedure assumes that you want to add a save-to-workspace block named,save_wksp, to the Signal and
%Scope Manager Tool. The procedure below decribes how to create the new
%viewer from scratch. You can skip to the end(Add Files to Path) if you want to use my included files
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Open a new Simulink library. For example, open the Simulink browser and select File > New > Library.
%Save the library. For example, save it as new_lib.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
In the MATLAB Command Window, set the library type for the library.
For example, to set the library type of newviewer to viewer,
set_param('new_lib','LibraryType','SSMgrViewerLibrary')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
To set library type for generators, use the type 'SSMgrGenLibrary'. For example,
set_param('new_lib','LibraryType','SSMgrGenLibrary')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Set the display name of the library. For example,
set_param('new_lib','SSMgrDisplayString','My Custom Library')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Drag and Drop a Save-to-workspace block into the library. Name the Block save_wksp
Set the iotype of the viewer. For example,
set_param('newlib/newviewer','iotype','viewer')
Save the library new_lib. In the Simulink window, selectFile > Save .
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Using the MATLAB editor, create a file named sl_customization.m. In this file, enter a directive to incorporate the new library as a viewer library. For example, to save newlib as a viewer library, add the following lines:
function sl_customization(cm)
cm.addSigScopeMgrViewerLibrary('new_lib')
%end function
FYI-->To add a library as a generator library, add a line like the following:
cm.addSigScopeMgrGeneratorLibrary('newlib')
Add a corresponding cm.addSigScope line for each viewer or generator library you want to add.
%**************Add Files to Path ************************
Save the sl_customization.m file AND THE FILE new_lib.mdl on your MATLAB path. Edit both of these files to add new viewer or generator libraries.
To see the new custom libraries, restart MATLAB and start the Signal & Scope Manager
You should see the custom Library