Error in compiled Program

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.
Thanks for your help.

1 Comment

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.

Sign in to comment.

Answers (2)

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.

Products

Asked:

on 30 Dec 2015

Answered:

on 31 Dec 2015

Community Treasure Hunt

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

Start Hunting!