×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

eval - data file that includes headers

eval - data file that includes headers

eval - data file that includes headers

(OP)
All,

I try to create an array with some data files and the code I use is the next one:

files=dir('F:\Strain Data\January\*.dat');
d={};
for i=1:length(files)
eval(['d{' int2str(i) '}=load(files(' int2str(i) ').name);']);
end

The code seems to work. However, my data files have headers! In that case the function "load" does not apply!!!

Any help?

RE: eval - data file that includes headers

use the uiimport command to analyse one file and tick the box marked generate m code. Then look at that to see how it has analysed your file.

I think this is the last post in which I do your assignment for you.

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: eval - data file that includes headers

(OP)
I have already solved the problem. You cannot use uimport to import so many data files. This is not the solution. The solution is much much more complex than this. If you use uimport you need to import manually 20,000 files. You need a year for that.

But thank you for your time. However, if that's how feel please do not answer any of my next questions. I hope I didn't force you to do so far. But really thank you especially for the first time you answered my question. It gave me a really good idea about which concept to follow in the beginning.

RE: eval - data file that includes headers

Greg's suggestion is perfectly fine and the same one I would have given. Greg also helped get you to this point only a day earlier:

http://www.eng-tips.com/viewthread.cfm?qid=342002

Before you burn all your bridges on this forum, please contribute to the spirit of helping others by posting your solution.

RE: eval - data file that includes headers

Yeesh... what's the deal with that guy? This seems like one of those situations where you don't look a gift horse in the mouth.

In case anyone stumbles across this thread looking for an answer, one solution might be to use the dlmread command, which allows you to skip header rows.

CODE --> Matlab

files=dir('F:\Strain Data\January\*.dat');
for n=1:length(files)
  data{n}=dlmread('files(n).name','\t',1);    %For a tab-delimited file. Skips first row.
end 

This is not as complicated as the OP suggested.

http://www.mathworks.com/help/matlab/ref/dlmread.h...

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close