Undefined function or variable 'xlim' Error

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.

 채택된 답변

Fangjun Jiang
Fangjun Jiang 2019년 12월 5일

0 개 추천

run"which -all xlim"?

댓글 수: 5

I get
Error using run
Too many input arguments.
im an idiot...here is the result....
which -all xlim
C:\Program Files\MATLAB\R2019a\toolbox\matlab\graph3d\xlim.m
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 2019년 12월 5일
that code works fine
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.....

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Performance and Memory에 대해 자세히 알아보기

제품

릴리스

R2019a

태그

질문:

HpW
2019년 12월 5일

댓글:

HpW
2019년 12월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by