Search found 3 matches
- 4 years ago
- Forum: Modeling
- Topic: how to get any element from a two dimensional set
- Replies: 4
- Views: 6028
Re: how to get any element from a two dimensional set
You can compute your ord value yourself with a loop: Set i /1*3/; set j /1*3/; Set a(i,j) /1.2, 2.3, 1.3/; parameter ordOfA(i,j); scalar cnt / 0 /; loop{a(i,j), cnt = cnt + 1; ordOfA(i,j) = cnt; }; display a, ordOfA; Be careful how you use this, though. If you want to do something for the tuples in...
- 4 years ago
- Forum: Modeling
- Topic: how to get any element from a two dimensional set
- Replies: 4
- Views: 6028
Re: how to get any element from a two dimensional set
How about this? Set i /1*3/; set j /1*3/; Set a(i,j) /1.2,2.3,1.3/; set b(i,j); b(i,j)$(ord(i) = 3 and ord(j) = 1) = yes; That's a good idea. But I need to put it in the loop so that at the second set c element: Set i /1*3/; set j /1*3/; Set a(i,j) /1.2,2.3,1.3/; set b(i,j); set c/1*3/; loop (c, b(...
- 4 years ago
- Forum: Modeling
- Topic: how to get any element from a two dimensional set
- Replies: 4
- Views: 6028
how to get any element from a two dimensional set
Hi,
I have a set:
How may I get the first, second or third element from set a by ordinality?
I wanted to use but it didn't work with two dimensional set.
I have a set:
Code: Select all
Set i /1*3/;
set j /1*3/;
Set a(i,j) /1.2 2.3 1.3/;
I wanted to use
Code: Select all
ord(a)