Problen with using varsize
Show older comments
Hello! I need some problems with using function varsize. This is my code:
lambda = struct('lower', 0, 'upper', 0, 'eqlin', 0, 'ineqlin', 0);
coder.varsize('lambda.lower', [1,inf]);
coder.varsize('lambda.upper', [1,inf]);
coder.varsize('lambda.eqlin', [1,inf]);
coder.varsize('lambda.ineqlin', [1,inf]);
[xopt,zmin,exitflag,output2,lambda] = linprog(C1,A,B,[],[],LB1,[],[],options);
fprintf(1,Out1,xopt,zmin);
fprintf(1,'ExitFlag= %d\nIterats= %d\n',exitflag,output2.iterations);
fprintf(1,'Algorithm - %s\n',output2.algorithm);
fprintf('Dual problem\n');
fprintf(1,'y1 = %1.5f\ny2 = %1.5f\ny3 = %1.5f\n', lambda.ineqlin(1),lambda.ineqlin(2), lambda.ineqlin(3));
And I see this error:
MATLAB expression 'lambda.lower' is not of the correct size: expected
[1x1] found [3x1].
I try to compile MEX-function with codegen. What's wrong?
Accepted Answer
More Answers (0)
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!