How can I change the folder used by "openExample"?

I wanted to run a MATLAB/Simulink demo in R2021a and I need to run the "openExample" command to open it.
By default, the examples seem to be unpacked in this directory on Windows:
C:\Users\johndoe\Documents\MATLAB\Examples\R20xxx\toolbox\examplename
or
C:\Users\johndoe\OneDrive\Documents\MATLAB\Examples\R20xxx\toolbox\examplename
How can I change the path where the example files are unpacked to?

 채택된 답변

MathWorks Support Team
MathWorks Support Team 2021년 3월 22일
편집: MathWorks Support Team 2021년 3월 22일

0 개 추천

There are two options to change the folder used by "openExample":
1. Change the folder used by one particular example
You can use the 'workDir' option to open one instance of an example in a different working directory:
>> E = 'uav/UAVPackageDeliveryExample';
>> openExample(E,'workDir','C:\Documents\')
2. Change the folder used for all examples (global setting)
The directory used by "openExample" is determined by the userpath:
You can set your userpath to a different directory by using the command:
>> userpath('C:\Documents\')

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Search Path에 대해 자세히 알아보기

제품

릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by