how to plot graph for specific points

조회 수: 6 (최근 30일)
Balaji Ramdas
Balaji Ramdas 2022년 5월 9일
댓글: Riccardo Scorretti 2022년 5월 9일
i have plot graph for the specific points from a row
example: x= ( 1 2 3 4 5 7 8 9 ), y= ( a b c d e f g h i j )
i need to plot graph x v/s y between the points 3 - 8 only

채택된 답변

Riccardo Scorretti
Riccardo Scorretti 2022년 5월 9일
Assuming that variables a, b, ... j make sense, you can do more or less like this:
x = [1 2 3 4 5 7 8 9];
y = [a b c d e f g h i j];
plot(x(3:8), y(3:8), 'o-'); % use 'o-', or whatever you like as drawing style
  댓글 수: 2
Balaji Ramdas
Balaji Ramdas 2022년 5월 9일
Thank you that works, i need another help
I have a coloumn of numbers i need them to dispaly only the specified numnbers
r160=readtable('R160t.txt');
z=r160{:,1};
R160.txt has numbers from 1- 900 but i need values from 20 to 500, how do i write that ?
Riccardo Scorretti
Riccardo Scorretti 2022년 5월 9일
You must first convert z to an array of double (not it is a cell-array). Then you can use the function find:
z = cellfun(@(x) double(x), z); % this converts z to double
ind = find(20 <= z & z <= 500); % z(ind) are the values you are looking for

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by