gams:export_all_elements_of_parameter_including_zeros_from_gams_into_excel

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

Last revision Both sides next revision | |||

gams:export_all_elements_of_parameter_including_zeros_from_gams_into_excel [2008/06/17 15:16] support created |
gams:export_all_elements_of_parameter_including_zeros_from_gams_into_excel [2008/06/17 15:21] support |
||
---|---|---|---|

Line 1: | Line 1: | ||

===== How do I export all elements of parameter (including Zeros) from GAMS into Excel?===== | ===== 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 is little example, which also shows an alternative approach for variables: | + | 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 is little example, which also shows an alternative approach for variables: | ||

<code> | <code> | ||

$eolcom # | $eolcom # | ||

Line 8: | Line 10: | ||

variable y(i); | variable y(i); | ||

x(i) = uniformint(0,1); | x(i) = uniformint(0,1); | ||

- | y.m(i) = 1; #GAMS will now generate entries for all model attributes | + | y.m(i) = 1; #Generate entries for all variable attributes |

y.l(i) = x(i); | y.l(i) = x(i); | ||

- | x(i)$(not x(i)) = eps; # Assign Eps for x(i) = 0 | + | x(i)$(not x(i)) = eps; # Assign Eps to x(i) = 0 |

Execute_Unload 'results.gdx',x,y; | Execute_Unload 'results.gdx',x,y; | ||

$onecho >param.txt | $onecho >param.txt |

IMPRESSUM / LEGAL NOTICE
PRIVACY POLICY
gams/export_all_elements_of_parameter_including_zeros_from_gams_into_excel.txt · Last modified: 2008/06/17 15:34 by support