David escreveu:
Hi Davis,
With regard to your question I suggest you to follow these steps:
*a) Installation:
First of all, you need to install both MATLAB and GAMS on your machine.
We will assume that the relevant system (installation) directories are: C:\MATLAB and C:\GAMS 1. Copy matout.gms in C:\GAMS\inclib\matout.gms 2. Copy gams.dll in C:\MATLAB\toolbox\local\gams.dll 3. Set the environment variable path of GAMS To test the installation, carry out the following steps: 1. Start up MATLAB 2. In the MATLAB command window, change directories to the examples directory provided as part of the distribution (This directory contains at least two files, testinst.m and testinst.gms that are required for this test.) 3. Run the example “testinst” that is found in the examples directory of the distribution. At the MATLAB prompt you just type:
>>testinst
The resulting output will depend on the platform on which you run this from. *b) Returning Values to MATLAB:
In order to run the same model within MATLAB and return the solution vector
variable of x(i) and parameter of d(i, j) back into the MATLAB workspace, one change is required to the GAMS file, namely to add the below line after the SOLVE statement: $libinclude matout x.l i
$libinclude matout d i j
This just writes out the level values of the solution to a file that can be read back
into MATLAB. In MATLAB, you just execute the following statement: [x d] = gams('NameGamsFile');
For more information click here:
or
my weblog: http://mortezash.blogfa.com/ (in Persian)
Morteza Sha'ban-Zadeh
|
|
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
This question and ones like it seem to be common ones. I collected
some thoughts on this, along with a fully-worked-out example
illustrating my suggested approach, and made this available as a FAQ
at http://www.gams.com/~steve/gdxmrw.html. HTH,
-Steve
Dear Steve,
You right. I used an older version of the GAMS/MATLAB interface tools but absolutely I will update it.
Thanks,
|
Hello everyone!
I am trying to link Matlab and GamsHello everyone!
--
You received this message because you are subscribed to the Google Groups "gamsworld" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "gamsworld" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.