How does MATLAB know what toolboxes are installed?

조회 수: 23 (최근 30일)
Paul
Paul 2014년 8월 7일
댓글: Andreas Goser 2014년 8월 8일
The toolboxes get installed underneath `$INSTALL_PATH/toolbox` but there seems to be more at play than just probing a set path on the file system. What goes on in the installer when a new toolbox is installed to an existing MATLAB installation?

채택된 답변

Paul
Paul 2014년 8월 8일
I think I figured out my question, though perhaps I just didn't know what to ask. The `ver` command seems to magically know what toolboxes are installed, and when I looked, it was scanning the MATLAB search path to figure out the names and versions of the toolboxes which are installed.
At that point, all I needed to know is how the global MATLAB search path is initialized. The answer seems to be an automatically-generated file located at `$INSTALL_ROOT/toolbox/local/pathdef.m`. It contains a list of hard-coded search paths that I think are only updated at install time.
I'm not sure what the MATLAB installer uses to regenerate this file, so if for some reason you are not depending on the MATLAB installer to do this, you will have to devise some alternate means (unless someone else knows better). Though, I do see in `$INSTALL_ROOT/toolbox/local/path` a bunch of simple *.phl text files which appear to have relative paths to all the installed toolboxes, so perhaps that would be of aid.

추가 답변 (2개)

Yu Jiang
Yu Jiang 2014년 8월 7일
Type ver (See Documentation) in the command window and see if you have the toolbox in the list.
  댓글 수: 1
Paul
Paul 2014년 8월 8일
Thanks, I do know about the `ver` command and it's how I've been verifying that MATLAB sees a toolbox. I've dug through the source code of it, and it seems like it works by scanning the toolboxes on the MATLAB path. So, I guess the question then becomes, how does MATLAB bootstrap the paths?

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


Image Analyst
Image Analyst 2014년 8월 8일
Actually apparently it's not much more than putting all your files in a folder and adding that folder to the search path. Here's the official Mathworks Answer: http://www.mathworks.com/matlabcentral/answers/91381-how-do-i-create-my-own-matlab-toolbox-and-a-list-of-its-contents
Your accepted answer of "it uses ver to figure out what toolboxes are installed" is not really accurate. Sure, it will tell you what toolboxes are installed, but even if you never ever call ver , MATLAB will still figure out what toolboxes are installed because it will find toolbox functions you call by traversing the search path. ver is not required.
  댓글 수: 1
Andreas Goser
Andreas Goser 2014년 8월 8일
In addition, you may want to distinguish between installed and licensed products. The can be important in situations where the IT departments installs efficiently all purchased products for let's say 1000 users, but they are not all licensed for all products, but by persor or department. Check out the 'license' command.

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

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by