compile program into '.exe' file but it went wrong when running this '.exe' file

65 views
Skip to first unread message

Skye Lu

unread,
Aug 4, 2018, 4:14:18 AM8/4/18
to YALMIP
Dear Johan,

I am trying to compile my program which uses YALMIP to solve problems into '.exe' file. When I run this '.exe' file, it went wrong. But when I run '.m' file, the result is correct.
I use sedumi as my solver.
I use the command below to create this '.exe' file, I don't know which step is wrong.

mcc -e myfile.fig myfile.m sedumi.m callsedumi.m


Do you know any feasible solutions? Thanks a lot!

Sincerely,
Skye Lu


Johan Löfberg

unread,
Aug 4, 2018, 4:51:54 AM8/4/18
to YALMIP
answered (or maybe not...) in other post

Skye Lu

unread,
Aug 4, 2018, 4:55:46 AM8/4/18
to YALMIP
I also try to use this command:
mcc -e myfile.fig myfile.m callsedumi.m sedumi.m ada_pcg.m install_sedumi.m

but while compiling, following errors appears:
索引超出矩阵维度。 
 
出错 mtree/kind (line 9) 
    a = o.KK{ o.T( o.IX, 1 ) }; 
 
出错 matlab.depfun.internal.getSig (line 103) 
    switch myRoot.kind 
  
Unable to determine function name or input/output argument count for function  
in MATLAB file "ada_pcg.m".  
Please use MLINT to determine whether this file contains errors. 

Johan Löfberg

unread,
Aug 4, 2018, 5:04:15 AM8/4/18
to YALMIP
try removing ada_pcg from the list. It appears to be some obsolete thing

Skye Lu

unread,
Aug 4, 2018, 6:08:10 AM8/4/18
to YALMIP
Hi Johan,
Thank you for your reply!
I tried to remove ada_pcg from the list, the errors appeared while compiling no longer exists, but the generated exe file still doesn't work.

Johan Löfberg

unread,
Aug 4, 2018, 6:34:30 AM8/4/18
to YALMIP
define "doesn't work"
Message has been deleted
Message has been deleted

Skye Lu

unread,
Aug 4, 2018, 6:48:29 AM8/4/18
to YALMIP
Hi Johan,
this is my main code:

Output = load('Output.mat');
Output = Output.Output;
Dic = load('Dic.mat');
Dic = Dic.Dic;
U = load('U.mat');
U = U.U;

[M,N]=size(Dic);
lambda = 0.3;
iter = 1;


x = sdpvar(N,1);

Constraints = [];

Objective = (lambda*norm( U(:,iter).*x, 1 )+ 0.5*sum((Dic* x-Output).^2) )

options = sdpsettings('solver','sedumi','verbose',0)

sol = optimize(Constraints,Objective,options);

if sol.problem == 0
 % Extract and display value
 solution = value(x)
else
 display('Hmm, something went wrong!');
 yalmiperror(sol.problem)
end

a=num2str(solution(1));
set(handles.edit1,'string',a);

when I run this '.m' file, the result is like this(it's correct):

but when I run the generated '.exe' file, the result is like this(it does not give out the solution):


Johan Löfberg

unread,
Aug 4, 2018, 6:52:40 AM8/4/18
to YALMIP
why on earth are you turning off display when you are trying to debug?! That's the info you want to see to be able to debug to see what is going wrong

Skye Lu

unread,
Aug 4, 2018, 7:31:04 AM8/4/18
to YALMIP

Hi Johan, 

Thanks for your suggestion. I am so sorry to bother you again, I am not very familiar with matlab so my questions may seem silly. After I try to turn on display

the information showed that 'Solver not found(sedumi)'

this is the error information:

but I already have add the sedumi package to matlab path, I don't know why the solver can't be found.


Johan Löfberg

unread,
Aug 4, 2018, 8:32:03 AM8/4/18
to YALMIP
edit ada_pcg and change it to

function y = ada_pcg(x)
y
=x;


and then include it again in the compilation directive

Skye Lu

unread,
Aug 4, 2018, 11:16:06 PM8/4/18
to YALMIP
Thank you Johan! Your answer perfectly solves my problem! Thank you so much!
Reply all
Reply to author
Forward
0 new messages