Warm tip: This article is reproduced from serverfault.com, please click

其他-Excel Anylogic的三维数组

(其他 - three dimensional array from excel anylogic)

发布于 2020-12-09 09:03:28

我想用Excel工作表中的值填充三维参数。因此,对于每一年,我都需要每个月的CFS值并将其保存在此参数中,但是我不知道该怎么做。

我已经用年,月,箱这三个维度创建了参数。

数据表

感谢帮助!

Questioner
Handballer73
Viewed
11
Emile Zankoul 2020-12-09 17:29:18

假设你有15年12个月和12个回收箱:

for( int i = 0 ; i < 15 ; i++ )
{
   for( int j = 0 ; j < 12; j++ )
   {
      for( int k = 0 ; k < 12 ; k++ )
      {
        p[i][j][k] = excelFile.getCellNumericValue( 1 , 7 + j*12 + k, i + 3);
      }
   }
}