User Tools

Site Tools



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

Link to this comparison view

Both sides previous revision Previous revision
gams:export_all_elements_of_parameter_including_zeros_from_gams_into_excel [2020/12/10 15:39]
Atharv Bhosekar removed
— (current)
Line 1: Line 1:
-===== How do I export all elements of  parameter (including Zeros) from GAMS into Excel?===== 
-GAMS only generates entries in a GDX file for those parameters, which are not equal to Zero or to their default values. A Zero will not be stored. However, we can tell GAMS to store an ''​EPS''​ (Epsilon) instead and instruct ''​GDXXRW''​ to use a Zero when writing the value for '​Epsilon'​. ​ 
-Below you find an example, which also shows an alternative approach regarding variables: 
-$eolcom # 
-set i    /i1*i10/; 
-parameter x(i); 
-variable ​ y(i); 
-x(i) = uniformint(0,​1);​ 
-y.m(i) = 1;                 #​Generate entries for all variable attributes 
-y.l(i) = x(i); 
-x(i)$(not x(i)) = eps;      # Assign Eps to x(i) = 0 
-Execute_Unload '​results.gdx',​x,​y;​ 
-$onecho >​param.txt 
-EpsOut =0 par =x   rng =a1 
-sq =n     var =y   rng =a4 
-Execute '​GDXXRW.EXE results.gdx @param.txt'​ ; 
IMPRESSUM / LEGAL NOTICEPRIVACY POLICY gams/export_all_elements_of_parameter_including_zeros_from_gams_into_excel.1607611150.txt.gz ยท Last modified: 2020/12/10 15:39 by Atharv Bhosekar