I am trying to print a structure array

2 次查看(过去 30 天)
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

回答(1 个)

Walter Roberson
Walter Roberson 2022-8-11
structfun(@(F) mat2str(F), lambda3, 'uniform', 0)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by