I am trying to print a structure array

2 Ansichten (letzte 30 Tage)
Scott
Scott am 11 Aug. 2022
Beantwortet: Walter Roberson am 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

Antworten (1)

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

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by