Quick question on import data

2 ビュー (過去 30 日間)
Jesse
Jesse 2012 年 3 月 18 日
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 Center および File ExchangeFile Operations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by