- Do you receive warning and/or error messages? If so the full and exact text of those messages (all the text displayed in orange and/or red in the Command Window) may be useful in determining what's going on and how to avoid the warning and/or error.
- Does it do something different than what you expected? If so, what did it do and what did you expect it to do?
- Did MATLAB crash? If so please send the crash log file (with a description of what you were running or doing in MATLAB when the crash occured) to Technical Support so we can investigate.
DEBUGGING FOR STANDALONE APP ?
6 views (last 30 days)
Show older comments
Rakan Khair
on 21 Sep 2023
Commented: Walter Roberson
on 26 Apr 2025
Hope you are all doing well
I made an app using app designer to read a counter by screen shot using screencapture.m and to turn the light green if the number changed or red if stayed the same , when run with matlab it works great , but when trying it as a standalone exe on the same laptop the program does not work
classdef neuro < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
Lamp matlab.ui.control.Lamp
LampLabel matlab.ui.control.Label
startButton matlab.ui.control.Button
end
% Callbacks that handle component events
methods (Access = private)
% Button pushed function: startButton
function startButtonPushed(app, event)
for in=1:inf
imageData = screencapture(0, [700,700,150,100]);
imwrite(imageData,'flag.jpg');
flag=ocr(imread('flag.jpg'))
n=str2num(flag.Text)
pause(.5)
imageData = screencapture(0, [700,700,150,100]);
imwrite(imageData,'flag.jpg');
flag=ocr(imread('flag.jpg'))
x=str2num(flag.Text)
image= uiimage(app.UIFigure,"ImageSource",'flag.jpg');
image.Position=[256,288,200,200];
if mod(n,1)==0
if mod(x,1)==0
if x==n
app.Lamp.Color = 'r'
else
app.Lamp.Color = 'g'
end
end
end
end
2 Comments
Steven Lord
on 21 Sep 2023
What does "does not work" mean in this context?
Accepted Answer
Rakan Khair
on 22 Sep 2023
Edited: dpb
on 26 Apr 2025
1 Comment
Walter Roberson
on 26 Apr 2025
You could have done
imageData = screencapture(0, [700,700,150,100]);
flag = ocr(imageData);
without needing to write to file at all.
More Answers (0)
See Also
Categories
Find more on MATLAB Compiler in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!