Re: FORALL STATEMENT
- From: Craig Powers <enigma@xxxxxxxxxx>
- Date: Mon, 30 Oct 2006 17:00:11 -0500
jdturner wrote:
Experts,
I have a recurring application need where I have many conditions to be
evaluated simultaneously, with only a single valid response. For
example, one might have the following code fragment:
forall( 1 = 1:n, all( mask=v-a(i) == 0 ) ) tmp(1) = i
ans: tmp(1)
I know that forall wants an array solution==> I have provided a
artifical array with one location being set equal to i. My question
is: (1) is there another way, (2) is this portable?
FORALL is, fundamentally, an array assignment statement, but it appears to me that you're trying to turn it into a loop.
Since you're trying to find a single index i, I suspect that the most efficient (and also least tortured) way to do what you want is to use a vanilla DO loop to locate the correct index, save it, and EXIT out of the loop.
.
- References:
- FORALL STATEMENT
- From: jdturner
- FORALL STATEMENT
- Prev by Date: Re: READ-statement and a segmentation fault
- Next by Date: Re: READ-statement and a segmentation fault
- Previous by thread: FORALL STATEMENT
- Next by thread: import selected module variables within that module's procedures
- Index(es):
Relevant Pages
|
|