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?

 Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 22 Mär. 2021
Bearbeitet: MathWorks Support Team am 22 Mär. 2021

0 Stimmen

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\')

Weitere Antworten (0)

Kategorien

Produkte

Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by