User Tools

Site Tools


interfaces:how_do_i_import_data_into_a_multi-dimensional_table

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
interfaces:how_do_i_import_data_into_a_multi-dimensional_table [2012/07/11 18:32]
admin
interfaces:how_do_i_import_data_into_a_multi-dimensional_table [2020/06/24 10:45] (current)
Lutz Westermann some formatting
Line 4: Line 4:
 Find below an example which illustrates how to do this. The trick is to delay the use of ''​$ondelim'',​ so GAMS can figure out what the structures is of the table (dimensions of the rows and columns). ​ Find below an example which illustrates how to do this. The trick is to delay the use of ''​$ondelim'',​ so GAMS can figure out what the structures is of the table (dimensions of the rows and columns). ​
 <​code>​ <​code>​
-Sets +Set 
-   n '​scenario set' ​    ​/​s0*s1100/​ +   ​n ​   '​scenario set' ​   /​s0*s1100/​ 
-   i '​project set' ​     /i1*i3/ +   ​i ​   '​project set' ​    ​/i1*i3/ 
-   para '​parameter set' /resv, ip, wresv, decay/ +   para '​parameter set' ​  ​/resv, ip, wresv, decay/ 
-   ph 'phase set' ​      /ph1, ph2, ph3/+   ​ph ​  ​'phase set' ​      /ph1, ph2, ph3/
 ; ;
-TABLE scen(n, i, para, ph) 'all data are logged and in csv format'​+Table scen(n, i, para, ph) 'all data are logged and in csv format'​
   i1.resv.ph1 i1.ip.ph1 i2.resv.ph1 i2.ip.ph1 i3.resv.ph1 i3.ip.ph1   i1.resv.ph1 i1.ip.ph1 i2.resv.ph1 i2.ip.ph1 i3.resv.ph1 i3.ip.ph1
-$ondelim+$onDelim
 $include scenpv.csv $include scenpv.csv
-$offdelim+$offDelim
  
 option scen:6:3:1; display scen; option scen:6:3:1; display scen;
Line 20: Line 20:
 **scenpv.csv** **scenpv.csv**
 <​code>​ <​code>​
-s1,    4.484497, ​   5.590780, ​   9.565448, ​  ​-2.776771, ​   2.017210, ​   0.403969 +s1,     ​4.484497, ​   5.590780, ​   9.565448, ​  ​-2.776771, ​   2.017210, ​   0.403969 
-s2,    4.039559, ​   7.829553, ​   1.965880, ​   4.383472, ​   0.832007, ​   5.789936 +s2,     ​4.039559, ​   7.829553, ​   1.965880, ​   4.383472, ​   0.832007, ​   5.789936 
-s3,    2.557665, ​   2.588679, ​  ​18.390045, ​   1.562361, ​  ​-1.775599, ​  ​-1.249638 +s3,     ​2.557665, ​   2.588679, ​  ​18.390045, ​   1.562361, ​  ​-1.775599, ​  ​-1.249638 
-s4,    7.979709, ​   8.760805, ​  ​-0.482130, ​   7.159645, ​  ​13.708082, ​   1.417433 +s4,     ​7.979709, ​   8.760805, ​  ​-0.482130, ​   7.159645, ​  ​13.708082, ​   1.417433 
-s5,    0.696502, ​   4.404599, ​   0.503611, ​   0.834050, ​  ​11.337872, ​  ​10.814183 +s5,     ​0.696502, ​   4.404599, ​   0.503611, ​   0.834050, ​  ​11.337872, ​  ​10.814183 
-s6,   ​18.435462, ​   2.077279, ​   5.328744, ​   0.618193, ​   6.188519, ​   3.306824 +s6,    18.435462, ​   2.077279, ​   5.328744, ​   0.618193, ​   6.188519, ​   3.306824 
-s7,    3.306904, ​   0.556912, ​  ​19.002177, ​   7.614140, ​  ​13.621738, ​   1.301998 +s7,     ​3.306904, ​   0.556912, ​  ​19.002177, ​   7.614140, ​  ​13.621738, ​   1.301998 
-s8,   ​10.388623, ​   8.810147, ​  ​11.926869, ​  ​-1.214278, ​  ​20.940576, ​   7.139113 +s8,    10.388623, ​   8.810147, ​  ​11.926869, ​  ​-1.214278, ​  ​20.940576, ​   7.139113 
-s9,    7.147472, ​  ​10.465706, ​  ​14.562816, ​  ​11.444166, ​  ​-1.436094, ​  ​-2.144297+s9,     ​7.147472, ​  ​10.465706, ​  ​14.562816, ​  ​11.444166, ​  ​-1.436094, ​  ​-2.144297
 s10,    1.728924, ​   1.424648, ​   3.307312, ​   9.400273, ​   4.361133, ​   1.460645 s10,    1.728924, ​   1.424648, ​   3.307312, ​   9.400273, ​   4.361133, ​   1.460645
 </​code>​ </​code>​
Line 120: Line 120:
  
 Table csvtable(s,​r,​a) ​    3 dimensional table Table csvtable(s,​r,​a) ​    3 dimensional table
-$ONDELIM +$onDelim 
-$INCLUDE ​data.csv +$include ​data.csv 
-$OFFDELIM+$offDelim
 display ​ csvtable; display ​ csvtable;
 </​code>​ </​code>​
  
IMPRESSUM / LEGAL NOTICEPRIVACY POLICY interfaces/how_do_i_import_data_into_a_multi-dimensional_table.txt · Last modified: 2020/06/24 10:45 by Lutz Westermann