how to solve the error "Unrecognized function or variable ".

, I have this code and its gave me a solution of my proplem and the solution must satiesfied the condition of the sum( the condition of the sum is the sum of the number are linked together with this line must different for every time and we must have no repeated sum) like the photo below.
the variable N : is the rows number , M : the columns number and P : is the number of solution must appear, when I run the code error appear, the error is "Unrecognized function or variable 'seq'." for anyone can help if you can solve it do it please,

 채택된 답변

Cris LaPierre
Cris LaPierre 2021년 9월 17일
편집: Cris LaPierre 2021년 9월 17일
The error suggests your code either can't find a function you use (it is not in the current folder or on the MATLAB path), or you are trying to use a variable that does not exist.
a = seq
Unrecognized function or variable 'seq'.
Your function returns a variable seq, so I suspect in your case it is the 2nd issue causing the error. A quick glance shows that seq is created in if statements, so what is likely happening is that your condition is never true, so seq is never created.
if Test=='T'
seq(:,:,v) = ...

댓글 수: 7

Thanks alot, but if you can show me clearly what I can do to solve it because Iam really bad in matlab, so please if you can help me do it🌹🌹
You need to figure out why Test never equals 'T'.
I would consider it best to start your function by defining seq so that this error does not occur. It could be something as simple as seq=[] placed somewhere at the top of your function.
seq=[];
a = seq
a = []
Rami Ahmed
Rami Ahmed 2021년 9월 17일
편집: Rami Ahmed 2021년 9월 17일
But like this the solution like the image down will never appear because I try this and the solution doesn't appear, Iam sorry because Iam annoying you but if you can help me
You have fixed what was causing the error message, but have not fixed the underlying issue that seq is never assigned a value because Test never equal T. That appears to be an issue with your data. You should consult with the author of the code or the source of your data to fix that.
Thanks you and Iam sorry for watse your time, but if you can tell how I can improve my skill in matlab
Practice!
If you need help getting started, a great first step is MATLAB Onramp. In 2 hours, you will learn the basics of MATLAB. From there, explore other courses you may have access to here: https://matlabacademy.mathworks.com/
Thanks alot you are the best🌹🌹

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

추가 답변 (0개)

카테고리

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

질문:

2021년 9월 17일

댓글:

2021년 9월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by