Why I got the following error when I run the ".exe" file compiled by matlab 2012b?

My code is a very simple one, as shown below:
function C = MyAdd(A,B)
C = A+B;
end
I compiled it to .Exe file, then run the Exe file. And I got the following error:
warning: Initializing Handle Graphics failed in matlabrc.
This indicates a potentially serious problem in your matlab setup.
which should be resolved as soon as possible. Error detected was:
MATLAB: undefinedVarOrClass
Undefined variable "graphics" or class "graphics,internal.initializeMATLABRoot".
Warning:failed to add default profiler filters.
>In matlabrc at 163
Undefined function 'javaaddpath' for input arguments of type 'cell'.
Undefined function 'javaaddpath' for input arguments of type 'cell'.
Besides, the dialog of the error is always a flash.
What should I do to solve this problem???

回答 (1 件)

Romain
Romain 2014 年 5 月 22 日

0 投票

I'm not sure that you can create an *.exe file with only a function. I think that you have to compile a script.

4 件のコメント

Lucky
Lucky 2014 年 5 月 23 日
I have save the code as a script, a ".m" file.
Romain
Romain 2014 年 5 月 23 日
This is a function (MyAdd.m):
function C = MyAdd(A,B)
C = A+B;
end
This is a script which call the function (MyScript.m) :
C = MyAdd(2,3)
Lucky
Lucky 2014 年 5 月 26 日
I have change my code, as shown below:
function C = MyAdd(A,B)
A = 10;
B = 32;
C = A+B;
disp('the result of A+B is')
disp(C);
end
But it still has the same problem. However, when I run the code in matlab2010(32-bit)(with VS2010 and windows 32-bit), it's very OK. I want to know why? How to solve?
Lucky
Lucky 2014 年 5 月 29 日
Hello???Can you help me?

この質問は閉じられています。

質問済み:

2014 年 5 月 22 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by