필터 지우기
필터 지우기

How to add custom Yaxis option for UIAxes via Editfield(Numeric) while plotting in matlab appdesigner (Ver 2020a)

조회 수: 3 (최근 30일)
Hello,
i m trying to give user option to set Y-axis for the plot axis. so user can limit the axis at it own preference
i take two simple Variable data lets say
a = [1 2 3 4 5];
b = [2 6 3 8 5];
plot(app.UIAxes,a,b);
then in "plot" button callback i defined
value = app.YAxisMinValueEditField.Value;
app.UIAxes.XAxis = value;
but it gives error that
"You cannot set the read-only property 'XAxis' of UIAxes."
kindly suggest a solution...currently i m trying only for min value editfield.

채택된 답변

Adam Danz
Adam Danz 2020년 10월 16일
ymin = app.YAxisMinValueEditField.Value;
ymax = app.YAxisMaxValueEditField.Value; % I'm guessing this handle
ylim(app.UIAxes, [ymin, ymax])
  댓글 수: 3
taimour sadiq
taimour sadiq 2020년 10월 17일
편집: taimour sadiq 2020년 10월 17일
can u please guide me futther... i m now controlling the axiseditfield via checkbox that user want to input axis aur wish to use default axis.
Now when i start i works fine... plot directly and when checkbox is selected then it plot according to edit field axis... but problem starts when i switch off check box it does not directly plot with pushbutton of "Plot"
function Axis(app)
app.a = [1 2 3 4 5];
app.b = [2 6 3 8 5];
if app.AxisCheckBox.Value
app.p = plot(app.UIAxes,app.a,app.b);
ymin = app.YAxisMinValueEditField.Value;
ymax = app.YAxisMaxValueEditField.Value;
ylim(app.UIAxes, [ymin, ymax]);
else
plot(app.UIAxes,app.a,app.b);
end
end
Adam Danz
Adam Danz 2020년 10월 17일
if app.AxisCheckBox.Value
app.p = plot(app.UIAxes,app.a,app.b);
ymin = app.YAxisMinValueEditField.Value;
ymax = app.YAxisMaxValueEditField.Value;
ylim(app.UIAxes, [ymin, ymax]);
else
plot(app.UIAxes,app.a,app.b);
% You forgot to implement the ylim here
end

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by