Quick question on import data

2 views (last 30 days)
Jesse
Jesse on 18 Mar 2012
Hey everybody,
Just some sample lines here, and I'm trying to see what they exactly do:
data = importdata('Filename1.dat');
ModelFile = data.data;
Ok - I know the first line above reads in the data from the file.
So what exactly does the second line do (especially the data.data part)?
Now referring to these lines below, I'm trying to model it like the above 2 lines, but I'm getting errors. Can someone explain what I am doing wrong?
helodata1 = importdata('GougeTable.dat');
HeloModelFile1 = helodata1.helodata1;
helodata2 = importdata('MasterDataChart.dat');
HeloModelFile2 = helodata2.helodata2;
Thanks!
-J

Accepted Answer

Walter Roberson
Walter Roberson on 18 Mar 2012
and read the Output Arguments section.
HeloModelFile1 = helodata1.data;
HeloModelFile2 = helodata2.data;
  2 Comments
Jesse
Jesse on 18 Mar 2012
Walter,
Thanks for taking a look and the help. I understand it a little better.
One more quick question. My other data file (the MasterDataChart one), I'm still getting an error. It's saying it's unable to load it and that I should try textscan or fread. So I decided to go with fread, and I was going through the routine line by line until I hit an error. Allow me to explain:
helodata2helper = fopen('MasterDataChart.dat'); %Use fopen first to open the file
helodata2 = fread(helodata2helper); %From the help, fread(fileID), so that's the helper
HeloModelFile2=helodata2.data;
The error says "Attempt to reference field of non-structure array." Now I'm confused since this is the error I was getting even before you responded. I thought I was doing ok looking at the help.
Any other advice?
Thanks!
-J
Jesse
Jesse on 18 Mar 2012
Oh sorry, the first 2 lines are ok in that brief code snippet I just sent, but when I do the third line (with the helodata2.data), that's when I get the error. Sorry.

Sign in to comment.

More Answers (0)

Categories

Find more on File Operations in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!