User Tools

Site Tools


This is an old revision of the document!

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.1213709676.txt.gz ยท Last modified: 2008/06/17 15:34 by support