how to extract error data from a error plot

조회 수: 22 (최근 30일)
CLARK KENDRICK GO
CLARK KENDRICK GO 2019년 4월 4일
답변: Walter Roberson 2019년 4월 4일
I have an error plot, and I want to extract the data (x,y, and error values) from this. How do I do this?
Thanks
  댓글 수: 4
Walter Roberson
Walter Roberson 2019년 4월 4일
Does it have error bars on the X Data, or only on the Y Data?
CLARK KENDRICK GO
CLARK KENDRICK GO 2019년 4월 4일
delta along y data

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

채택된 답변

Walter Roberson
Walter Roberson 2019년 4월 4일
The below assumes that the handle of the axes containing the errorbar() is in the variable ax such as ax = gca;
h = findobj(ax, 'type', 'errorbar');
if isempty(h)
error('no errorbar found in axes designated by "ax"');
end
if numel(h) > 1
warning('more than one errorbar found; outputs will be cell array')
end
X = get(h, 'XData');
Y = get(h, 'YData');
YNeg = get(h, 'YNegativeDelta');
YPos = get(h, 'YPositiveDelta');
If you had called errorbar using the form
errorbar(vector_of_x, vector_of_y, vector_of_error_values)
then YNeg and YPos will have the same content, and that content will be the same as the vector of error values.
If you had called errorbar using the form
errorbar(vector_of_x, vector_of_y, first_vector_of_error_values, second_vector_of_error_values)
then YNeg will have the same content as first_vector_of_error_values, and YPos will have the same content as second_vector_of_error_values.

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by