What is the difference between the userpath and the startup folder?
18 ビュー (過去 30 日間)
古いコメントを表示
I know how to config Startup Folder! I think it is very similar between the userpath and Startup Folder!
I save my *.m file in the Startup Folder. Startup Folder is in the Search Path.
Is there any case of "Startup Folder is not a userpath,or userpath is not a Startup Folder"?
0 件のコメント
回答 (1 件)
MarKf
2023 年 8 月 5 日
編集済み: MarKf
2023 年 8 月 5 日
They are different. Matlab starts in the startup folder, the initial working folder, it's displayed on the "Current Folder" panel, in the Toolbar and with the command pwd right after Matlab starts, before you or a script optionally change it with cd. You can set it also in your personal startup script you can put in userpath. It is suggested that you set your startup folder as your userpath (in the link above it even lists the advantages) but it's not a requirement. Also, if you open a file with Matlab (like an .m file which you doubleclick on it and you have Matlab set to open it) then it will start in the folder the file is in, for convenience, then it's likely to be different anyway. Otherwise Matlab starts in the startup folder (I like the preference "Last working folder from previous session") when you just open it from the Matlab icon. They are both in your search path automatically.
2 件のコメント
MarKf
2023 年 8 月 7 日
Not much really, except that you put the startup script (an .m file that gets run at Matlab startup, you can add whatever you need in there) in the userpath folder. The folder is added automatically and it stays in your search path every time matlab starts, like all the other default matlab toolbox folders (but it's somewhat less convenient to change those in the MATLABPATH environment variable), and like any of those you can even remove it with pathtool (or with userpath('clear')). I guess by using the userpath, you can add the scripts you always need there, whereas the initial working folder could be changed with different projects. But a good folder management with checks adding folders and toolboxes you need is always a good idea anyway regardless.
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!