Hi Hossein
How about this?
Set i /i1*i3/;
Set j /j1*j2/;
Set k /k1*k6/;
parameters
matrix(i,j)
vector(k)
counter;
\
matrix(i,j) = uniform(2,10);
counter = 0;
loop(i,
loop(j,
counter = counter + 1
loop(k$(ord(k) = counter), vector(k) = matrix(i,j) ;
);
);
);
display vector;
display matrix;
Cheers
Renger
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Hossein Karimi
Sent: Dienstag, 20. Mai 2014 10:02
To: gamsworld
Subject: Re: Transform a matrix to a vector
for example, I want to change
a=
[1 2 3
4 5 6
7 8 9];
to
b=[1 2 3 4 5 6 7 8 9];
Thanks in advance.
On Tue, May 20, 2014 at 12:23 PM, Renger van Nieuwkoop wrote:
Hi Hossein
You should give an example of what you want to do (what kind of vector do you want, what is a general form?)
Cheers
Renger
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Hossein Karimi
Sent: Dienstag, 20. Mai 2014 08:11
To: gamsworld
Subject: Transform a matrix to a vector
Dear members;
How can I transform a matrix to a vector in GAMS in a general form?
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send 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.
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send 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.
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send 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.