What is the difference between the userpath and the startup folder?
18 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
MarKf
el 5 de Ag. de 2023
Editada: MarKf
el 5 de Ag. de 2023
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 comentarios
MarKf
el 7 de Ag. de 2023
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.
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!