Reputation: 29
I have tried to define Useduration as the 3D array but I did not know how to define the tuple elements. I have received an error" float of 2 dimensions not supported for sheet". is there a way to read it from excel?
` {string} sources=...;
range time=1..Time;
tuple useduration {
float frequency;
float Averageduration;
}
useduration Useduration[time][sources]=...;
dat.file
sources=7;
Time=2;
Useduration= [
[<7.2,0.67>,<0.6,5>,<7.2,0.67>,<2,3>,<0.28,1>,<0.31,1>,<0.4,1>],
[<7.2,0.67>,<0.6,5>,<7.2,0.67>,<2,3>,<0.28,1>,<0.31,1>,<0.4,1>]]`
Upvotes: 1
Views: 64
Reputation: 10037
What you could do is read 2 2D arrays and then build the tuple array:
.mod
int Time=...;
int nbsources=...;
{int} sources=asSet(1..nbsources);
range time=1..Time;
tuple useduration {
float frequency;
float Averageduration;
}
//useduration Useduration[time][sources]=...;
float fr[time][sources]=...;
float Av[time][sources]=...;
useduration Useduration[t in time][s in sources]=<fr[t][s],Av[t][s]>;
execute
{
writeln(Useduration);
}
.dat
nbsources=7;
Time=2;
//Useduration= [
// [<7.2,0.67>,<0.6,5>,<7.2,0.67>,<2,3>,<0.28,1>,<0.31,1>,<0.4,1>],
// [<7.2,0.67>,<0.6,5>,<7.2,0.67>,<2,3>,<0.28,1>,<0.31,1>,<0.4,1>]];
//
fr= [
[7.2,0.6,7.2,2,0.28,0.31,0.4],
[7.2,0.6,7.2,2,0.28,0.31,0.4]];
Av= [
[0.67,5,0.67,3,1,1,1],
[0.67,5,0.67,3,1,1,1]];
The best way is to go through a tuple set. You have an example in this Technote:
https://www.ibm.com/support/pages/node/125333
Upvotes: 1