xlim is not working

조회 수: 15 (최근 30일)
Chang seok Ma
Chang seok Ma 2021년 12월 3일
댓글: DGM 2025년 2월 13일
Hello,
I am trying to use xlim to limit my x-axis
h_to_plot = linspace(1,20,20);
horizon = 1:1:20;
quant = 1.64;
mat = [coefficients ses [1:1:20]'];
[~,idx] = sort(mat(:,1));
sortedmat = mat(idx,:);
figure(3)
errorbar(horizon(h_to_plot),sortedmat(h_to_plot,1),quant*sortedmat(h_to_plot,2),'o','Linewidth',2)
hold on
xlim = ([0 20.5])
However, I could not make x-axis starts from 0 to 20.5
Is there any way I could use xlim to extend my x axis to 20.5?
Thanks

채택된 답변

VBBV
VBBV 2021년 12월 3일
xlim([0 20.5]) % difference
Difference in using and = between the xlim and parenthesis
  댓글 수: 5
Paul
Paul 2025년 2월 12일
I don't think I've ever seen this error message before idenitfying the ambiguity between the variable and the function. Is that new?
Is there any overhead incurred by Matlab having to determine the xlim is also a function in this case?
Would it also indicate if xlim is some other useful thing, like an .m file or .slx file or a class definition?
DGM
DGM 2025년 2월 13일
This is a common mistake, and future readers should make sure that the variable that they mistakenly created gets cleared, otherwise the error will persist even after the code is fixed.
clear xlim

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by