Está en la página 1de 4

> Lee Ying

Hola,

1.) Debe crear un directorio con el nombre que desee. Esto puede ser encuentra dondequiera que usted desee. Si no est en la ruta de acceso estndar MATLAB (utilice el comando path para comprobarlo) utilizar el pathtool para agregar su directorio a la ruta de MATLAB.

2.) Usted pone una copia del archivo slblocks.m en el directorio que usted ha creado. En este archivo se debe adaptar la estructura del navegador. para ejemplo cambiando a: . Navegador (1) Library = 'myBlockLib1'; Browser (1) Nombre = 'myBlockLib1'.; . Navegador (1) IsFlat = 0;

3.) Abrir el navegador biblioteca Simulink (tipo Simulink de Matlab o el botn). All selecciona crear un nuevo modelo. Guardar este modelo vaco como myBlockLib1 si utiliza este libname en 2.) o cualquier otro, pero debe corresponder a la del archivo slblocks.m.

4.) Poner los bloques en el modelo que acaba de crear.


Mostrar una biblioteca en el Explorador de Biblioteca
1. Crea una carpeta en el MATLAB ruta de la biblioteca de alto nivel y sus sub-bibliotecas. Debe guardar cada biblioteca de nivel superior que desea que aparezca en el Library Browser en su propia carpeta en la ruta de MATLAB. Dos bibliotecas de nivel superior no pueden existir en la misma carpeta. Creacin o copia de la biblioteca de alto nivel y sus sub-biblioteca en la carpeta que ha creado en el camino MATLAB. En la carpeta de la biblioteca de nivel superior, incluir una slblocks.m archivo. El mtodo que se utiliza para crear el slblocks.m archivo depende de sus necesidades para la descripcin de la biblioteca: Si un mnimo slblocks.m archivo adapte a sus necesidades, a continuacin, crear una nueva slblocks.m archivo, basado en el ejemplo de abajo Si se quiere describir la biblioteca ms completa, considere copiar un archivo slblocks.m existente para utilizar como plantilla, editar la copia para describir su biblioteca (vase ms adelante).

2. 3.

Ejemplo de un archivo slblocks.m Minimal


Para mostrar una biblioteca en el Explorador de Biblioteca, como mnimo, debe incluir estas lneas (ajustados para describir su biblioteca; comentarios no son necesarios) en la slblocks.m archivo. funcin blkStruct = slblocks % Especifique que el producto debe aparecer en el navegador de la biblioteca % Y se almacenan en cach en su repositorio Browser.Library = 'mylib'; Browser.Name = "Mi biblioteca"; blkStruct.Browser = Browser;

Aadir informacin ms descriptiva en slblocks.m


Puede revisar otra informacin descriptiva es posible que desee incluir en su slblocks.m archivo mediante el examen de los comentarios en el Simulink biblioteca slblocks.m archivo: matlabroot / caja de herramientas / Simulink / Bloques / slblocks.m .

Subject:
How do I add a custom library to the Simulink Library Browser in Simulink 4.1(R12.1)?

Problem Description:
I have created a custom library in Simulink 4.1(R12.1) and would like to add it to the Simulink Library Browser.

Solution:
The ability to add custom libraries to the Simulink Library Browser is available in Simulink 4.1(R12.1). Refer to the documentation link below for more information. http://www.mathworks.com/help/simulink/libraries.html In particular, refer to the "Create Block Libraries" and "Add Libraries to the Library Browser" sections in the documentation. The 'slblocks.m' files shipped with Simulink are commented and explain the necessary modifications. You can view one of these files by typing the following at the MATLAB command prompt:

edit slblocks
Follow the instructions outlined in the 'slblocks.m' file and make changes which apply to your custom library. Here are the general steps to follow: 1. Place each custom library within its own directory. 2. Copy the 'slblocks.m'file into each directory that has one of your libraries. This file is present at the following location. $MATLABROOT/toolbox/simulink/blocks/slblocks.m where $MATLABROOT is the directory where MATLAB is installed and can be known by executing the following command at the MATLAB Comamnd Prompt.

matlabroot

3. In order to add these directories with the custom libraries to the MATLAB path and save them, execute the following commands.

addpath('directory') savepath

4. Make sure that the MATLAB path includes the path to these directories. You can execute the following command at the MATLAB command prompt to find out what directories are on your path.

path

5. Make sure that the name of the customized file is also saved as 'slblocks.m'.

Simulink Component-Based Modeling Model Architecture Libraries

Add Libraries to the Library Browser


On this page

Display a Library in the Library Browser Example of a Minimal slblocks.m File Add More Descriptive Information in slblocks.m

Display a Library in the Library Browser


1. Create a folder in the MATLAB path for the top-level library and its sublibraries. You must store each top-level library that you want to appear in the Library Browser in its own folder on the MATLAB path. Two top-level libraries cannot exist in the same folder. 2. 3. Create or copy the top-level library and its sublibraries into the folder you created in the MATLAB path. In the folder for the top-level library, include a slblocks.m file. The approach you use to create the slblocks.m file depends on your requirements for describing the library: If a minimal slblocks.m file meets your needs, then create a new slblocks.m file, based on the example below If you want to describe the library more fully, consider copying an existing slblocks.m file to use as a template, editing the copy to describe your library (see below).

Example of a Minimal slblocks.m File

To display a library in the Library Browser, at a minimum you must include these lines (adjusted to describe your library; comments are not required) in the slblocks.m file.

function blkStruct = slblocks % Specify that the product should appear in the library browser % and be cached in its repository Browser.Library = 'mylib'; Browser.Name = 'My Library';

blkStruct.Browser = Browser;
Add More Descriptive Information in slblocks.m
You can review other descriptive information you may wish to include in your slblocks.m file by examining the comments in the Simulinklibrary slblocks.m file: matlabroot/toolbox/simulink/blocks/slblocks.m.

También podría gustarte