Quick question on import data

2 次查看(过去 30 天)
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

采纳的回答

Walter Roberson
Walter Roberson 2012-3-18
and read the Output Arguments section.
HeloModelFile1 = helodata1.data;
HeloModelFile2 = helodata2.data;
  2 个评论
Jesse
Jesse 2012-3-18
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 2012-3-18
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 File Operations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by