Error in compiled Program
Show older comments
Hello Matlabers, I have a problem in my program created in MATLAB R2015a. I coded a program about Newton's cooling law. It works in Matlab Perfectly. After I compiled this program. I opened Test Release and start the .exe file in Windows 10. GUI Appears after I press the calculate button program has created blink sound. I searched cause of that sound and command prompt of windows shows following errors.
Error in soguma>pushbutton1_Callback (line 193)
Error in gui_mainfcn (line 95)
Error in soguma (line 42)
Error in @(hObject,eventdata)soguma('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback
What is the reason of that ERROR.
I uploaded files in my drive. The link is: https://drive.google.com/file/d/0B0cYUACDfN-1TEJ5cmlZcy1TYjQ/view?usp=sharing
Thanks for your help.
1 Comment
Image Analyst
on 30 Dec 2015
Isn't there more? Usually it gives the reason for the error, something more descriptive than just "Error while evaluating UIControl Callback" but an actual reason, for example some variable is being used before it's been defined, or index out of range, or something.
Answers (2)
Image Analyst
on 30 Dec 2015
0 votes
You're probably missing a file. Have you seen the FAQ: http://matlab.wikia.com/wiki/FAQ#My_standalone_executable_won.27t_run_on_the_target_computer._What_can_I_try.3F
Walter Roberson
on 31 Dec 2015
Your code calls upon dsolve(), which is part of the Symbolic Toolbox. Nothing in the Symbolic Toolbox can be compiled.
What you need to do in a case like this is do the dsolve() symbolically at the MATLAB level, outside of this program.
syms Tc T(t) k Tilk
formula = dsolve(diff(T(t))== -k*(T(t)-Tc),T(0)==Tilk);
Now write it to a file as a MATLAB function:
matlabFunction(formula, 'Vars', [Tc, k, t, Tilk], 'File', 'sicaklik');
Now you go into your code and remove the "syms" and calculation of the dsolve and so on, and instead call upon sicaklik() -- but passing in one more parameter than you do in the existing code, with the extra parameter being the numeric value of Tilk
By the way, the formula comes out as
sicaklik = @(Tc, k, t, Tilk) Tc + exp(-k*t) .* (Tilk-Tc);
and you could just hard-code that.
Categories
Find more on Code Performance 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!