Saving path when Importing Data using MATLAB's default GUI
古いコメントを表示
My MATLAB scripts live in the Matlab installation dir, while my data files live on other HDDs. When I run my scripts and import data via uigetfile, I save the path to the most recently imported data (in an "ini" file), and default to that path upon the next uigetfile call. This allows me to navigate to the most recent data quicker, and this is what (essentially) all software I know does (like opening documents from a recent location in Office).
However, when I need to import data using the MATLAB GUI (not via my own scripts), MATLAB always defaults to the MATLAB start path, and never saves the most recent path the data was imported from. In the long run, this makes importing data from the MATLAB GUI tedious. Is there a way to make MATLAB's GUI save the most recent path to data that it imported from? This would be like Office always defaulting to the location to its bin folder when trying to open a document; every MATLAB version I dealt with (since about 2001) had this.
1 件のコメント
I don't know waht you mean with "MATLAB start path". MATLAB defaults to your (last) working directory (also called pwd "path working directory" in MATLAB). That is where most likely your scripts are:
pwd
The idea is (or what I think the idea is) to normally have your data in your working directory, or a subfolder [see below]. Then opening your current working directory would be the best.
% Example
-myDirectory
|-data
||-datafile1.csv
||-datafile2.mat
|-script1.m
|-script2.mlx
I do not know of a way to default to the folder you last imported from, but I have a workaround:
- You can open your scrips like you normally do.
- Then you change your working directory (see image above) to the folder where your datafiles are.
- After that you can import multiple files and you always default to that folder.
- If you have finished you may want to set your working directory back to the original one. For this there is a neat trick. You can press the small arrow to the far right of the current working directory. There the last working directories are stored and you can simply click on the one you want. Next time you can use the arrow directly when you want to import data from the same folder again
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Startup and Shutdown についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!