Unrecognized function or variable 'max'.
Mostrar comentarios más antiguos
I am facing an issue while using Matlab app designer.
It seems that when I am using App designer, it is giving the following error "unrecognised function or variable ''max"' for 'max'.
but when I use it in workspace without opening the app. It works fine. I have attached 2 screenshots for reference, one with app paused in debugger, other without opening the app.
And these lines of codes were working fine before, started giving problems from last 2 days.
I am not generating any variable named max within the app.
I tried both MATLAB 2021b and 2022b, same problem persists
What kind of problem this is?
Have a nice day ahead.
10 comentarios
Geoff Hayes
el 26 de Sept. de 2022
@RITAM BASU - can you attach the code for your GUI?
RITAM BASU
el 26 de Sept. de 2022
Editada: RITAM BASU
el 26 de Sept. de 2022
Geoff Hayes
el 26 de Sept. de 2022
When running your code and you pause it in the debugger, what happens if you run the following from the command line
k>> which max
What is the result of this call?
RITAM BASU
el 26 de Sept. de 2022
Geoff Hayes
el 26 de Sept. de 2022
Editada: Geoff Hayes
el 26 de Sept. de 2022
What happens if you do the same but type
>> pwd
to check the current working directory? You can do this before or after you have launched your app too so that we can see if there is a change in the path.
RITAM BASU
el 26 de Sept. de 2022
Geoff Hayes
el 26 de Sept. de 2022
Can you attach your GUI so that we can try to reproduce the issue?
RITAM BASU
el 26 de Sept. de 2022
Geoff Hayes
el 26 de Sept. de 2022
Is that the mlapp file or does that include supporting files?
RITAM BASU
el 26 de Sept. de 2022
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 26 de Sept. de 2022
1 voto
>> restoredefaultpath
4 comentarios
RITAM BASU
el 26 de Sept. de 2022
Image Analyst
el 26 de Sept. de 2022
Do you have any calls to "clear" anywhere in your program?
Search everywhere in your program for "max". Examine every single line where max is mentioned to see that it look okay.
Do this in the command window immediately after starting MATLAB:
v = [1,2,3,4];
maxValue = max(v)
What do you see?
RITAM BASU
el 26 de Sept. de 2022
Image Analyst
el 27 de Sept. de 2022
I agree with Walter below. You defined max somewhere. Then you stopped at a breakpoint and, in the command window, said "clear all" so that blew away your max. When you tried to use max after that, it said that it didn't know what max was anymore. Of course, since you cleared it. Clear all will get rid of private variables and functions but not built-in ones. But because your private max overrode the built-in one, it no longer knows about the built-in max. When you cleared your private max, it evidently does not automatically restore the definition of max to the built-in one.
You didn't answer if you searched everywhere for max. Search for max and then reply with every single line where max is mentioned. Don't leave any out.
Categorías
Más información sobre Entering Commands en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!