There are (at least) two ways to export data from Matlab and loading them into GAMS: using a CSV file or using a GDX file. Here is a small comparison with a large matrix (4 million entries):
| CSV file | GDX file |
Matlab | m=2000; n=2000; A=rand(m,n); | m=2000; n=2000; A=rand(m,n);
p.name = 'A'; p.type = 'parameter'; p.val = A; p.form = 'full';
path('c:\gams\win64\24.0',path); wgdx ('c:\projects\tmp2\data.gdx', p);
|
Time | 3.85 seconds | 4.2 seconds |
GAMS | table a(*,*) | parameter a(*,*); |
Time | 0.72 seconds | 0.69 seconds |
The timings are similar. As always the timings need to be taken with a grain of salt.
Hi, I am a new user of cplex.
ReplyDeleteWhy I add a line "Display a.L;" when I use the gdx file code, there is some error?
Hello, I am trying to modify a table in gams from matlab. for example, in gams I set up :
ReplyDeleteTable data(s,t,r)
r1 r2
s1.t1 1.1 2.3
s1.t2 5.4 3.6
s2.t1 4.2 5.2
s2.t2 1.3 0.7
How can I change this table within matlab? thanks.