필터 지우기
필터 지우기

problem with overloaded plot in 2014b

조회 수: 2 (최근 30일)
Patrick Mboma
Patrick Mboma 2014년 11월 28일
편집: per isakson 2014년 11월 29일
Dear all,
I am facing a problem I have not seen before. I have overloaded the plot function for a certain class. Up until 2014a, I was able to call the overloaded method in either of the following ways:
plot(x,obj,varargin)
plot(obj,varargin)
The purpose of x in the first call is to restrict the x-axis of the plot to the values contained in x.
With 2014b, variable x does not even appear in the workspace of the overloaded plot method. That is, calling plot(x,obj) is the same as simply calling plot(obj). I have put a keyboard in the workspace of my overloaded plot function and x is nowhere to be found.
Can anybody explain to me what is going on?
Thanks,
  댓글 수: 2
Matt J
Matt J 2014년 11월 28일
편집: Matt J 2014년 11월 28일
We'll probably need a reproducible example, preferably an abbreviated version of your actual class. I can't confirm the phenomenon with tests of my own. The example class below shows all input arguments in R2014b with no surprises,
classdef myclass
methods
function plot(x,obj,y)
x,obj,y
end
end
end
Patrick Mboma
Patrick Mboma 2014년 11월 29일
편집: per isakson 2014년 11월 29일
Hi Matt,
Thanks for answering. I finally realized my mistake... or perhaps not exactly. The thing is that the data I plot have some nans at the beginning and at the end.
The overloaded function sets the xlim using the information in x. But then, outside the plot function, I was setting axis to tight. In that case all the nan parts disappear, which I was not expecting.
This is what I was interpreting as 2014b ignoring the x input. The basic problem can be easily replicated say
x=1:100;
y=log(x);
y([1:10,90:100])=nan;
plot(x,y)
matlab automatically ignores the nans at the beginning and at the end of y.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by