필터 지우기
필터 지우기

Plotting .txt files for a defined range

조회 수: 1 (최근 30일)
Alex M.
Alex M. 2016년 11월 29일
답변: KSSV 2016년 11월 29일
Hi, I am using the following code to plot y vs x from a .txt file. The .txt file has only 2 columns in it. However, my range of x data are from 200 to 1000 and I only want to plot from 400 to 700 for the x axis and have their associate y values. How can I implement this in my code?
fid=fopen('1GPL.txt');
s=textscan(fid,'%d %d %d','headerlines',23);
fclose(fid);
x=s{1};
y=s{2};
plot(x,y)

채택된 답변

KSSV
KSSV 2016년 11월 29일
Let x,y be your full data.
xi=x(x>=400 & x<=700);
yi=y(x>=400 & x<=700);
plot(xi,yi)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by