I am trying to print a structure array

조회 수: 1 (최근 30일)
Scott
Scott 2022년 8월 11일
답변: Walter Roberson 2022년 8월 11일
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에서 Low-Level File I/O에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by