フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

how can i store the output from the function in a matrix/vector to use as input in my main

1 回表示 (過去 30 日間)
Bhavz
Bhavz 2014 年 10 月 25 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
i have the following function as a m file and i want to store the c and ceq values calculated in a separate individual matrix which i can pass as inputs to another function in my main how can i do that ?
function [c,ceq] =constraint(X_dp1)
global hd ce Ye delta_edp;
%first constrain
X_dp=reshape(X_dp1,4,8);
X_dp=reshape(X_dp1,4,8);
for ii=1 : 16
ro(ii)=0;
for jj=1 : 4 %demand
for kk=1:8
if delta_edp(ii,jj,kk)==1
ro(ii)=ro(ii)+hd(jj)*X_dp(jj,kk);
end
end
end
ro(ii)=ro(ii)/ce(ii);
end
ro_max=max(ro);
for ii=1:16
A(ii)=0;
C(ii)=0;
for jj=1:4
for kk=1:8
A(ii)=A(ii)+hd(jj)*delta_edp(ii,jj,kk)*X_dp(jj,kk);
end
end
B(ii)=ce(ii);
C(ii)=C(ii)*(1-Ye(ii));
end
c=A-B;
ceq=(A./B)-C-ro_max;
end

回答 (1 件)

per isakson
per isakson 2014 年 10 月 26 日
編集済み: per isakson 2014 年 10 月 26 日
Isn't this good enough?
[c,ceq] = constraint( X_dp1 );
out = another_function( c, ceq );
  5 件のコメント
Bhavz
Bhavz 2014 年 10 月 26 日
Exactly so if x = intlinprog(f,intcon,A,b) where would my c and ceq be placed and how since the call to the function is from main
per isakson
per isakson 2014 年 10 月 26 日
That's a question about &nbsp intlinprog.
Read the documentation carefully and study the examples. Start at Linear Programming and Mixed-Integer Linear Programming

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by