필터 지우기
필터 지우기

How I can create a new library?

조회 수: 4 (최근 30일)
Fernando  Beltrán
Fernando Beltrán 2016년 9월 26일
댓글: Steven Lord 2016년 9월 26일
Good morning,
I have a question and I would like to know if anyone can help.
I want to create a new library and place it in Simulink Library Browser.
I created a file .slx with the function NewLibrary called "newlibary" and have also created a function (slblocks.m).
function blkStruct = slblocks
blkStruct.Browser (1) .library = 'newlibrary';
blkStruct.Browser (2) .Name = 'FERNANDO';
I have these two files but I do not know where I have to put the folder for Simulink recognize them.
Thank you very much

답변 (2개)

Steven Lord
Steven Lord 2016년 9월 26일
From step 6 on this documentation page:
"Where you save the library depends on how you plan to use it. If you want to add it to the Library Browser, save it to a folder on the MATLAB® path or add the location to the MATLAB path. Otherwise, save it to a location where the models that use the blocks can access it."
This documentation is for the most recent release. If you're using an older release, check the version of this page included in your installation's documentation in case the process has changed between the release you're using and the most recent release.
  댓글 수: 2
Fernando  Beltrán
Fernando Beltrán 2016년 9월 26일
Thanks, but one thing more. What is Matlab path? I have read it in many place, but I do not understand very well.
Steven Lord
Steven Lord 2016년 9월 26일
When you execute a program in MATLAB, MATLAB needs to know where the functions, scripts, classes, etc. that program calls are implemented. It does so by searching the MATLAB search path. From the Getting Started documentation:
"MATLAB looks for scripts and other files in certain places. To run a script, the file must be in the current folder or in a folder on the search path."
You can display the path by typing the command path at the MATLAB prompt. You can put your library file in any directory listed in that command's output, but I strongly recommend you avoid any directory under the toolbox subdirectory of your matlabroot directory. Those directories are intended to hold files that are part of MathWorks products, not user files.

댓글을 달려면 로그인하십시오.


Fernando  Beltrán
Fernando Beltrán 2016년 9월 26일
Thanks. I have created a folder with two files (New library.slx and *.m) I have added this folder to Matlab path. Then I have opened Simulink and Library Browser is empty. What can I do? Thanks
  댓글 수: 1
Steven Lord
Steven Lord 2016년 9월 26일
I think this shouldn't have been a separate answer but a comment on my answer. Anyway, take a look at step 5 in the checklist on the documentation page to which I linked.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Manage Products에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by