MATLAB Answers

How do I run a custom function when my toolbox gets installed?

조회 수: 1(최근 30일)
Thomas Satterly
Thomas Satterly 2021년 7월 21일
댓글: Thomas Satterly 2021년 7월 21일
I have a toolbox that is regularly distributed, and I'd like to run a custom function when the toolbox is installed. The purpose of this function is to check for other toolboxes (make sure dependencies are installed) and prompt the user to add a shortcut to launching an app packaged with the toolbox. I'd imagine Matlab doesn't allow you to do this, as that's a pretty easy way to run malicious code, and searching around the internet has yielded no results
  댓글 수: 1
Walter Roberson
Walter Roberson 2021년 7월 21일
I imagine that wanting to run a configuration script would be pretty common; it is a reasonable thing to want to do.

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

답변(1개)

Jan
Jan 2021년 7월 21일
How is the toolbox "regularly distributed"?
It is usual, that a toolbox or software has a "configure" function to set up the environment. Then simply add this to the installation instructions.
Does your toolbox have a main function? Then you could trigger the configuration once automatically e.g. by setting a persistent flag by setpref.
  댓글 수: 1
Thomas Satterly
Thomas Satterly 2021년 7월 21일
By "regularly distributed", I mean we ship regular update within our company and to our customer, where the only effort we want to require is to drag-and-drop the package into their command window. Right now, there's extra steps required to create a shortcut to the launcher, and we want to check to make sure other toolboxes are installed and are the right version.
I'm unfamiliar with user-defined preferences in Matlab, how can these be used to trigger function calls?

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by