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?

 Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 22 Mar 2021
Modifié(e) : MathWorks Support Team le 22 Mar 2021
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\')

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange

Produits

Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by