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 ExchangeSearch Path についてさらに検索

製品

リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by