Open folder in Matlab

Hi
I'm trying to open folder let's call it FolderA (Here is the directory: 'C:\Users\Usersname\Desktop\FolderA')in MATLAB that constains 9 Text Documents ('.txt') of size 30000-by-10. I want to be able to choose which files I want to observe that is one Text Doument, all Text Documents or i.e. Text Douments 1, 3 and 5.
I also want to use the selected files and use i.e. vector nr. 3 and 4 in all of them.
How does one do that?

 채택된 답변

Image Analyst
Image Analyst 2012년 10월 1일

1 개 추천

We have just the file for you in the File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/10867-uipickfiles-uigetfile-on-steroids, Doug Schwarz's uipickfiles:
Description
This is a GUI application that allows multiple files or directories to be selected and allows you to manage the list (remove files, reorder, etc.) before returning. It has basic filtering as well as regular expression filtering and navigation of the file system is easy. The output is configurable (cell, struct or char arrays). It is written entirely in M and so is platform independent.

댓글 수: 5

Lily
Lily 2012년 10월 1일
편집: Lily 2012년 10월 1일
This is a nice program but how do you get the files, that is load them into MATLAB? I tried using the following but that didn't work. What do you normally use? load(files)
Image Analyst
Image Analyst 2012년 10월 1일
편집: Image Analyst 2012년 10월 1일
It gives you a list of filenames. Then you have to load your files one at a time.
files = uipickfiles();
storedStructure = load(files{1}); % Same for files{2}, etc.
It offers a benefit over uigetfile() in that it lets you select multiple documents, which is (I think) what you were asking about. But just like uigetfile() you still have to open files one at a time, like I did above. I don't know of any function to let you open dozens of files at once, unless you wrote your own custom function to do that. If you want to just pick one file at a time, then use uigetfile().
Lily
Lily 2012년 10월 1일
OK, but if I were to use the load function like this:
n = input('Choose the files ');
files = uipickfiles('num',n,'out','ch')
for i = 1:n
file_(i) = load(files(i,:));
end
Could I construct a new FILE NAME, i.e. file1, file2 and so on, for every file that I load?
Not exactly, but close
fullFileNames = uipickfiles()
for k = 1 : length(fullFileNames)
fprintf('Processing %s\n', fullFileNames{k});
storedStructure = load(fullFileNames{k});
end
Lily
Lily 2012년 10월 1일
This is so COOL! Thx :)

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Adding custom doc에 대해 자세히 알아보기

질문:

2012년 10월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by