I am trying to print a structure array

2 views (last 30 days)
Scott
Scott on 11 Aug 2022
Answered: Walter Roberson on 11 Aug 2022
options=optimoptions(@linprog,'Algorithm','dual-simplex');
f=-1*[110;220;250;140];
A=[2/3,1,5/8,5/6;0,1,6/5,3/4;0,1,1/2,0;0,0,0,1];
ub=[10000;15000;8000;7000];
lb=[1000;2000;1000;2500];
[x,fval,exitflag,output,lambda3] = ...
linprog(f,A,ub,[],[],lb,ub,options);
% Slack Variable Calculation
P = x .* A'
Z = sum(P)
SV = ub - Z';
fprintf('%i\n', lambda3)
I was wondering what the code would be if I wanted to print the structure array lambda3 from the above code

Answers (1)

Walter Roberson
Walter Roberson on 11 Aug 2022
structfun(@(F) mat2str(F), lambda3, 'uniform', 0)

Community Treasure Hunt

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

Start Hunting!