Importing and Plotting Data

조회 수: 6 (최근 30일)
Paul
Paul 2014년 11월 18일
댓글: Paul 2014년 11월 18일
I have pasted 4 columns of data into a .txt file and then:
fileID=fopen('Lab5data.txt');
plot(data(:,1),data(:,2),data(:,3),data(:,4));
trying to plot all 4 on the same plot but im getting:
Undefined variable Data.
Error in Lab5Practice (line 42)
plot(data(:,1),data(:,2),data(:,3),data(:,4));
a few days ago i made a similar plot using the same method and it worked fine but today neither this nor the old one will work. I have not moved any files since then and the file path shows correct. What am i missing here?

채택된 답변

Hikaru
Hikaru 2014년 11월 18일
It's because you have not define the variable data .
  댓글 수: 5
Paul
Paul 2014년 11월 18일
that did it, thanks you so much!
The comment thing was my fault, i fixed it (i think) just after i hit submit and then looked up and saw the comment function. first time user here, wont happen again.
Paul
Paul 2014년 11월 18일
i used the data = dlmread('Lab5data.txt') and it worked.
seems somehow, maybe when it was saved, its capitalized "Data" as well as another thing, strange. Ill watch out for it next time.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by