Load and plot data from txt file
조회 수: 5 (최근 30일)
이전 댓글 표시
Good afternoon everyone,
I'm doing a research project where I have to create a GUI that allows you to open a .txt file and plot its contents. Here is my code so far:
%Opens file
[filename, pathname] = uigetfile('*.txt');
file = fullfile(pathname,filename);
S = load(file);
newfilename = (S(1:end-4));
x = newfilename(:,1);
y = newfilename(:,2);
plot(x,y);
For now I only have it specifically open the first 2 columns of data for convenience. This returns an empty plot. What am I doing wrong?
댓글 수: 0
채택된 답변
Azzi Abdelmalek
2013년 6월 4일
편집: Azzi Abdelmalek
2013년 6월 4일
To read a txt file use
dlmread
textscan
fgetl
fscanf
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!