why evalin doesnt wotk in App Designer matlab 2017b?
Show older comments
I am creating app in appdesginer .
When I ran the same code in same matlab version , it works but when I tried to implement it in app designer it gives error as
Undefined function or variable 'XXXX'.
What could be the reason or what could be the alternative for the same?
9 Comments
Considering that I don't know what you tried to execute or what was in whatever scope you tried to execute it in -- or how you tested it prior to this, I don't know. I am going to guess that the issue is possibly because you're not executing it in the same scope as when you were testing it. You will need to provide more information.
Rik
on 1 Nov 2021
Also, you shouldn't be using evalin anyway.
Kaustubh hike
on 2 Nov 2021
Kaustubh hike
on 2 Nov 2021
Kaustubh hike
on 2 Nov 2021
Rik
on 2 Nov 2021
Pass your variables as input arguments:
%you're doing this
a=1;
MyFun
function MyFun
a=evalin('base','a');
disp(a)
end
%you should do this
a=1;
MyFun(a)
function MyFun(a)
disp(a)
end
Kaustubh hike
on 2 Nov 2021
Rik
on 2 Nov 2021
That was just an example function. Since you haven't explained anything about how you call your function I can't actually suggest the real changes you should make. You shouldn't be needing evalin. You should use input arguments to your functions.
If you don't know how to do that I suggest you do a basic Matlab tutorial.
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!