User Tools

Site Tools


interfaces:what_is_the_default_layout_when_exporting_an_n-dimensional_parameter_or_set_from_gdx_to_excel

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
interfaces:what_is_the_default_layout_when_exporting_an_n-dimensional_parameter_or_set_from_gdx_to_excel [2010/05/18 14:08]
support
interfaces:what_is_the_default_layout_when_exporting_an_n-dimensional_parameter_or_set_from_gdx_to_excel [2020/05/26 12:20] (current)
Frederik Fiand
Line 1: Line 1:
 ====== What is the default layout when exporting an n-dimensional parameter or set from GDX to Excel using gdxxrw? ====== ====== What is the default layout when exporting an n-dimensional parameter or set from GDX to Excel using gdxxrw? ======
  
- The default layout for an n-dimensional parameter or set from GDX to Excel is to have n-1 indices in the row and one index in the column. For example, lets say you have a 3 dim parameter a(i,j,k) and you export ​this using gdxxrw ​ with default settings (meaning ''​rdim=2'',​ ''​cdim=1''​) you get a layout like this (A..E are the Excel column headers, 1-4 are the Excel row headers).+ The default layout for an n-dimensional parameter or set from GDX to Excel is to have n-1 indices in the row and one index in the column. For example, lets say you have a 3-dimensional ​parameter a(i,j,k) and you export ​it using [[https://​www.gams.com/​latest/​docs/​T_GDXXRW.html|GDXXRW]] ​ with default settings (meaning ''​rdim=2'',​ ''​cdim=1''​) you get a layout like this (A..E are the Excel column headers, 1-4 are the Excel row headers).
 <​code>​ <​code>​
-  A   ​B ​  ​C ​  ​D ​  ​E ​ ...+  A   ​B ​  ​C ​  ​D ​  ​E ​ ...  
 1         k1 k2  k3 1         k1 k2  k3
 2 i1 j1    1  2   3 2 i1 j1    1  2   3
Line 12: Line 12:
 . .
 </​code>​ </​code>​
-Below you find a small GAMS model that illustrates the impact of the different setting for rdim and cdim.+Below you find a small example ​that illustrates the impact of the different setting for rdim and cdim.
 <​code>​ <​code>​
 set i / i1*i3 / set i / i1*i3 /
Line 23: Line 23:
 $onecho > gdxxrw.txt $onecho > gdxxrw.txt
 i=a.gdx i=a.gdx
-o=a.xls +o=a.xlsx 
- +par=a rng=default!a1 
-par=a +par=a rng=rdim0_cdim3!a1 rdim=0 cdim=3 
-rng=default!a1 +par=a rng=rdim1_cdim2!a1 rdim=1 cdim=2 
- +par=a rng=rdim2_cdim1!a1 rdim=2 cdim=1 
-par=a +par=a rng=rdim3_cdim0!a1 rdim=3 cdim=0
-rng=0_3!a1 rdim=0 cdim=3 +
- +
-par=a +
-rng=1_2!a1 rdim=1 cdim=2 +
- +
-par=a +
-rng=2_1!a1 rdim=2 cdim=1 +
- +
-par=a +
-rng=3_0!a1 rdim=3 cdim=0+
 $offecho $offecho
 execute '​gdxxrw @gdxxrw.txt';​ execute '​gdxxrw @gdxxrw.txt';​
-execute '​shellexecute a.xls';+execute '​shellexecute a.xlsx';
 </​code>​ </​code>​
IMPRESSUM / LEGAL NOTICEPRIVACY POLICY interfaces/what_is_the_default_layout_when_exporting_an_n-dimensional_parameter_or_set_from_gdx_to_excel.txt · Last modified: 2020/05/26 12:20 by Frederik Fiand