Hi,
When I'm using eigs(A,B,K) in Matlab 2017b and receiving the following error:
Error: File: eigs.m Line: 1442 Column: 5
"c" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable.
A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval.
The code works with Matlab 2016b. What could be the problem when using Matlab 2017b?
Best regards, Emil

댓글 수: 8

I do not get that error when I test.
I suggest you put in
dbstop if error
and run the code. When it stops, ask
which -all c
to find out where c is being found. Perhaps you have a c.m of your own that is somehow interfering.
I agree with Walter that it is likely a function in file c.m, in the directory from which you are calling eigs. (I have found that just being in your path is ok, as long as it is not in your current working directory.)
Strangely, using "dbstop if error" (which is an excellent suggestion in general!) did not seem to help here. When I created a function file c.m in my current directory, and then called
eigs(rand(3),rand(3),2)
execution was not halted, and I was returned to the command line with the same error as Emil.
the cyclist
the cyclist 2018년 1월 18일
편집: the cyclist 2018년 1월 18일
This is a bug, right? There should be no problem with having such a file.
I'm finding some version-dependent behavior here, too. I do not see this behavior in R2017b.
Emil Aggestam
Emil Aggestam 2018년 1월 18일
I think it is a bug. I see no reason why you shall not be able to have a file namned c.m.
Christine Tobler
Christine Tobler 2018년 1월 18일
In general, I'd say it's a good idea to not have one-letter function names. However, I don't see why this should stop EIGS from working here. I'll take a look, this indeed sounds like a bug.
Possibly
dbstop if caught error
is needed to locate the problem.
the cyclist
the cyclist 2018년 1월 18일
That didn't halt execution either (at least for me).
the cyclist
the cyclist 2018년 1월 19일
편집: the cyclist 2018년 1월 19일
Addendum: I do see the bug in R2017b. I did the wrong test earlier.

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

 채택된 답변

Emil Aggestam
Emil Aggestam 2018년 1월 18일

0 개 추천

I had a file named c.m that caused the problem. Thank you!

추가 답변 (1개)

Christine Tobler
Christine Tobler 2018년 1월 24일

1 개 추천

Thank you for pointing out this bug. There is now a bug report available where this can be tracked, and it will be fixed in a future version.
To address a discussion in the comments, the reason that the debugger wasn't helping is that this error is coming from the initial parsing of eigs.m, before the function is entered (similar to what happens for an "if" without an "end": the whole file is seen as inconsistent).

카테고리

도움말 센터File Exchange에서 Programming Utilities에 대해 자세히 알아보기

제품

질문:

2018년 1월 18일

답변:

2018년 1월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by