Automatically Run Script at End of Toolbox Installation
조회 수: 9 (최근 30일)
이전 댓글 표시
I'm writing a toolbox and packaging it as described in Create and Share Toolboxes. At the end of the installation process, I want to automatically run a script. Is this possible? We are trying to support MATLAB R2016a onward.
댓글 수: 0
채택된 답변
Jan
2021년 10월 3일
I include a function, which runs once the first time the toolbox is called instead. This is "after the installation", but not directly after the installation, but before the first run. I use ispref and setpref to set a flag, which is persistent between Matlab sessions. But it matters as which user you run the toolbox.
댓글 수: 2
Jan
2021년 10월 6일
If there are no "main functions", e.g. a GUI, this is not trivial. Adding a:
checkInstalled;
and
function checkInstalled
persistent runOnce
if isempty(runOnce)
runOnce = true;
callYourSetupRoutine;
end
end
takes about 0.5 seconds for 1e6 calls. But is this installation really required in all subfunctions?
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File 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!