Skip to main content
10-Marble
June 30, 2011
Solved

Conditional extraction of vector/matrix elements

  • June 30, 2011
  • 1 reply
  • 5268 views

Hi,

is it possible in one line to extract a sub-vector of all elements in another vector which satisfy some rule e.g. all elements > 0 for example?

I know how to do it in a programming loop but if there is a built in method then it's likely to be more efficient.

I can do it easily in matlab like:

z = x(x>0)

Thanks,

D

Best answer by RichardJ

When I look at it, that does not work. You need lookup, not match.

Attached in version 11 and version 6 (as far back as I can go) formats.

1 reply

1-Visitor
June 30, 2011
DaveWooff10-MarbleAuthor
10-Marble
June 30, 2011

Hi thanks for that, however I'm on an old student version of Mathcad (OU study). Any chance you could post plain text?

Many thanks,

D

1-Visitor
June 30, 2011

Sorry for the delay upon responding I have been out training.

See below.

Clipboard01.jpg

Mike