MATLAB Custom Library

Source: Internet
Author: User
After installing the matlab2014b, I suddenly found that there is no content in the Simulink Library browser window and found a way to add it, hoping to help the needy friends. "Z; E4 o& \9 J2 m/p4 g
1. Create library file: Open the Simulink Library browser window. To create a simulink library file, start the Simulink work window first, click the "new" option under "File" in the menu bar, select the "Library" option and open a new library window interface, Users can add some of the modules they need to be added to the new window. Then save as OWN_EFINITION.MDL (the name of the library file you need to define). In this way, a custom library file is created.
2, in the MATLAB path to create the path of the library file, that is, the custom module library in the browser under the library display location. Note in MATLAB, each module library file must have a different path.
The Maltab path created is: D rogram filesmatlabr2011btoolboxsimulink Simulink mylibrary (determined by your own MATLAB installation path), where MyLibrary is a custom folder.
3. Copy the library file created in the first step to the new MATLAB path.  Select the "Set path" option under the "File" menu bar of the MATLAB main window, then click the "Add Folder" button to add the new path, then save it and exit (Close). (G-\2 R3 K!) M9 S1 z% V4 Z9 X
4. To display a custom module library, you also need to copy the SLBLOCKS.M function to the new path. In the command window of MATLAB, enter:, J! o* d# @5 L8 \
>> which (' slblocks.m ', '-all ')
>> open (' D rogram filesmatlabr2011btoolboxsimulink Simulink blocksslblocks.m ')

This allows you to open the Slbocks.m file template, which needs to be modified in order to display the custom module library under the Library browser window. First copy the slbocks.m file to your custom library file 9 C; {4 M5 M7 k) E3 x& I, u& K9 J
In the same directory (that is, the path you just created), and then open the file with the following modifications (red for the changes) and save:
function blkstruct = slblocks 9 r# E J t q+ S. T "~
%slblocks defines the block library for a specific Toolbox or Blockset. % Slblocks Returns information about a Blockset to Simulink. The% information returned is in the form of a blocksetstruct with the% following fields:% 1 t0 j% n# O4 k% n:m: N
% name Name of the Blockset in the Simulink block library% blocksets & toolboxes subsystem. 1 X R1 | (U (m:k ' R
% OPENFCN MATLAB expression_r (function) to call if you% double-click on the block in the Blocksets & toolboxes% su  bSYSTEM. -x$ y$ p:x1]4 q# r* Y
% maskdisplay Optional field that specifies the Mask Display commands% to use for the block in the Blocksets & Toolbo Xes% subsystem.
% Browser Array of Simulink Library Browser structures, described% below. 5 ^2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.