Reputation: 37
I am using OPL CPLEX 12.9 and I want to write my results in an excel file. It is a two dimension array and I want to write the results in two columns but is it only possible to write the Data in lines?
Example Code in .dat Product_Cost to SheetWrite (Daten, "Result!A1:B10");
What can I write for A1:B10 to get the results in two columns?
Upvotes: 1
Views: 228
Reputation: 10037
before doing SheetWrite you could transpose your matrix:
int M=2;
int N=5;
int A[i in 1..M][j in 1..N] = rand(4);
int B [j in 1..N][i in 1..M]=A[i][j];
execute
{
writeln("A=",A);
writeln("B=",B);
}
gives
A= [[0 0 0 0 1]
[3 2 3 2 0]]
B= [[0 3]
[0 2]
[0 3]
[0 2]
[1 0]]
Upvotes: 1