Clicking on hyperlink for an "example" on MATLAB command line help changes my current directory
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
This is not a question per se but a comment/complaint. Changing current directory is so disruptive. All I want to do is to just read the example. Anyone feel the same ?
0 commentaires
Réponses (1)
Steven Lord
le 2 Fév 2025
Do you want to read the example and potentially run some or all of it? I think that's a pretty common workflow for the examples. Examples may have helper files necessary to run them. Changing directory to the example's directory makes those helper files available to MATLAB.
We could stop changing directory, but then we'd have to tell you how and where you need to find those helper files when you tried to run a selection of the example. That could be very confusing and difficult (if you select a piece of the example in the Editor, copy it, and paste it into the Command Window, how would we necessarily know that the copied code originally came from an example and from which example it came?)
4 commentaires
Walter Roberson
le 2 Fév 2025
Examples generally are composed of multiple files. Browsing the files together requires changing the directory -- or else having the editor open all of the relevant files at the time of opening the example (which has its own issues.)
Voir également
Catégories
En savoir plus sur File Operations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!