Is there a way to browse parent folders of the current working folder?

조회 수: 19 (최근 30일)
I'm currently working on a project where I've separated the code into two folders which handle two conceptually related but functionally separate sets of tasks. If I sit at a parent folder of the two and add their folders to the path, I can easily view, edit, and run both sets of code at the same time, which is excellent for my workflow.
However, I'm running into issues related to running test cases on my code. I've been navigating to the folder where I want to dump the output and running a script, which works reasonably well and allows me to easily track the effects of changes to my code without needing to rewrite the test set. However, when I'm doing this, I'm effectively blind to all of my code, since all the browser shows me is the contents of the output folder.
Obviously, I can just keep the code open, or I can use the Open interface to navigate to the file that I want. Ideally, though, I'd like to flag a selected folder as the current working folder without collapsing the Current Folder browser onto it, letting me keep my setup there intact regardless of what I'm doing. Is there a way to do this?

채택된 답변

Image Analyst
Image Analyst 2015년 9월 11일
So you have folders b and c, and folder "a" is the parent of them. The code in b or c puts output into a different folder "d". If you set the "Current folder" panel to view folder d, then you can't see your m-files in folders b or c, and you want to. I think that captures what you've said.
So, you can either bring up another program, such as Windows Explorer, or you can design your own GUI where you have listboxes where each listbox contains the files and monitors a different folder.
  댓글 수: 2
Josh Kirby
Josh Kirby 2015년 9월 12일
So that's pretty much a no, then, I guess. Thanks for the help.
Image Analyst
Image Analyst 2015년 9월 12일
That's not a no. It's an invitation for you to learn how to develop more powerful and sophisticated GUIs than you can do now. I suggest you start here: http://blogs.mathworks.com/videos/category/gui-or-guide/
Then look at this for an easy to use framework that will get you up and running in a short time: http://www.mathworks.com/matlabcentral/fileexchange/24224-magic-matlab-generic-imaging-component Just use GUIDE to add a couple of listboxes that look at the other folders and you're all set.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Hamoon
Hamoon 2015년 9월 11일
I'm not sure if I got your question correctly, but have you tried cd?
doc cd
you can change your current folder whenever you want inside your code and make changes there and go to another folder by
cd(newFolder)
is this what you want?
  댓글 수: 2
Josh Kirby
Josh Kirby 2015년 9월 12일
That changes the GUI view of the current folder as well. I want to be able to keep the GUI view of the original root folder intact while still being able to have the local path relative to one of the the branches, rather than having the displayed root always be the same as the local path.
Hamoon
Hamoon 2015년 9월 12일
Actually Matlab does NOT change GUI view of the current folder when a code is running, that's a little bit tricky, you can start with the folder you want to see (suppose folder b) and in your code use "cd" to navigate to another folder (matlab does NOT show you this folder when your code is running, so you still see folder b), and in the end of your code again comeback to the folder b, so Matlab always will show you folder b. Isn't that what you want?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by