필터 지우기
필터 지우기

how can i cut data from a plot?

조회 수: 45 (최근 30일)
lucas
lucas 2014년 7월 31일
댓글: nam bui 2021년 2월 12일
hello, goodmorning folks
how can i cut a data clicking on a plotted data? i want to cut the data from where i click untill the end
anyone has this code?
thx :)
  댓글 수: 1
Sara
Sara 2014년 7월 31일
From where you click you mean:
  • cut the elements after the one you click on with respect to the x-axis?
  • cut the elements after the one you click on with respect to the position of the element in the original array?
Have you looked into ginput?

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

채택된 답변

Ben11
Ben11 2014년 7월 31일
편집: Ben11 2014년 7월 31일
As Sara suggests, using ginput to let the user select a x-value from which to crop:
clear
clc
x = 1:10*pi;
figure
subplot(2,1,1)
plot(x,sin(x));
title('Original plot');
uiwait(msgbox('Select an x-value from which to crop','modal'));
[x_user ~] = ginput(1); % Let the user select an x-value from which to crop.
x(x>x_user) = [];
subplot(2,1,2);
plot(x,sin(x));
title('New plot with cropped values');
xlim([min(x(:)) max(x(:))]);
results in the following:
  댓글 수: 1
nam bui
nam bui 2021년 2월 12일
Hello, I'm wondering how you you do it if I want to plot out both end of the graph, meaning when its at 2.5 and 25.5?

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by