MATLAB Answers

Undefined function or variable 'xlim' Error

조회 수: 1(최근 30일)
HpW
HpW 5 Dec 2019
Commented: HpW 5 Dec 2019
Hi.
All of a sudden I get the following error when running a function
Undefined function or variable 'xlim'.
Error in ba (line 50)
xlim([100 500])
I am using R2019a and have tried prior recomendations i found on the forum like the following:
restoredefaultpath
rehash toolboxcache
but this did not work. If i remove the
xlim([100 500])
line (line 50 in function) or change xlim to ylim then it runs fine.
Any help would be appreciated.

  댓글 수: 0

로그인 to comment.

채택된 답변

Fangjun Jiang
Fangjun Jiang 5 Dec 2019
run"which -all xlim"?

  댓글 수: 5

표시 이전 댓글 수: 2
Fangjun Jiang
Fangjun Jiang 5 Dec 2019
That looks good. Do you have a variable called "xlim" created when you try to run xlim()? try
clear all
plot(1:10)
xlim([0 15])
HpW
HpW 5 Dec 2019
that code works fine
HpW
HpW 5 Dec 2019
Ack. i figured it out....
I must have accidently deleted something in my function declaration which should be
function [xlim_a, xlim_b] = ba(var1, var2)
the typo deleted the "_a" and made it:
function [xlim, xlim_b] = ba(var1, var2)
fixing the typo fixed the issue....thanks so much for your help!!
Probably good example to not name variables close to main matlab functions.....

로그인 to comment.

More Answers (0)

이 질문에 답변하려면 로그인을(를) 수행하십시오.

태그

제품


릴리스

R2019a

Translated by