Hi Guys.. I need to print X values from intlinprog output from all 24 iterations as a matrix, when am trying to assign the values to A matrix its not happening. PLz help
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
clc
[load_data,txt,raw] = xlsread('Load profile data.xlsx');
schedule=zeros(24,8);
for i=1:24
f=[12 8 9 10 0 0 0 0];
intcon=[5,6,7,8];
A=[ 1 0 0 0 -1080 0 0 0;
-1 0 0 0 360 0 0 0;
0 1 0 0 0 -540 0 0;
0 -1 0 0 0 180 0 0;
0 0 1 0 0 0 -540 0;
0 0 -1 0 0 0 180 0;
0 0 0 1 0 0 0 -108;
0 0 0 -1 0 0 0 360];
b=[0 0 0 0 0 0 0 0];
Aeq=[1 1 1 1 0 0 0 0];
beq=[load_data(i,2)];
lb=[0 0 0 0 0 0 0 0];
ub=[1080 540 540 1080 1 1 1 1];
X=intlinprog(f,intcon,A,b,Aeq,beq,lb,ub);
schedule(i,:)=X'; %% here am getting dimension error??????
end
disp(schedule);
0 Commenti
Risposte (1)
John D'Errico
il 26 Set 2021
Modificato: John D'Errico
il 26 Set 2021
Of course, we cannot answer your question in more depth, since you have not provided your data. But if we look at the screenshot you supplied, it tells us the left hand side of an assignment was 1x8. On the right hand side of the assignment the result was 0x0.
What size is an empty array?
size([])
But consider what intlinprog will return if no solution is found? Yes. An empty array. And then MATLAB will complain. In fact, it will complain for exactly that reason, with exactly that error message. For example...
schedule = zeros(24,8);
schedule(1,:) = zeros(0,0);
Do you KNOW that a solution ALWAYS exists for all such possible problems? (Clearly not, since in at least one case, no solution is found.)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!