Import files in Matlab
Import files in Matlab
(OP)
My question is pretty simple however I haven't figured out yet.
So, I have a folder with 10,000 data files (*.dat) and I try to import them using a code because it is obvious I cannot import them one by one.
In that case the names of the files are in the form "filename_number"
The files' number should be the key in order to import them using a loop.
I used the function A=importdata('filename') to import one file. However, I need a loop in order to import all of them at once so as to create a vector of the one column I need from each file!
Any help???
So, I have a folder with 10,000 data files (*.dat) and I try to import them using a code because it is obvious I cannot import them one by one.
In that case the names of the files are in the form "filename_number"
The files' number should be the key in order to import them using a loop.
I used the function A=importdata('filename') to import one file. However, I need a loop in order to import all of them at once so as to create a vector of the one column I need from each file!
Any help???
RE: Import files in Matlab
The second method is less disgusting (ie less likely to turn your computer into a smoking ruin) but the eval approach is more in the spirit of your question, and you will learn more about the difference between cell arrays and strings.
Cheers
Greg Locock
New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?
RE: Import files in Matlab
The second approach looks great! I will try to implement it!
Another thing is that I have problem to load files from a directory different from the "documents" folder of matlab. When I use this location, the process works fine. However, I use a computer in the University and we are not allowed to paste more than 300-350 files in the matlab directory.
In that case, is there any way I can import my files from a different directory?
RE: Import files in Matlab
Cheers
Greg Locock
New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?