Clicking on hyperlink for an "example" on MATLAB command line help changes my current directory

2 次查看(过去 30 天)
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 ?

回答(1 个)

Steven Lord
Steven Lord 2025-2-2
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 个评论
Walter Roberson
Walter Roberson 2025-2-2
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.)

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 File Operations 的更多信息

产品


版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by