Is there a way to browse parent folders of the current working folder?
10 次查看(过去 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?
0 个评论
采纳的回答
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 个评论
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
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 个评论
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 Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!