[ADMB Users] extraction of array elements using selection logic
Fowler, Mark
Mark.Fowler at dfo-mpo.gc.ca
Mon Feb 25 09:44:23 PST 2013
I'm looking for an ADMB form of R-style logical selection from arrays.
Ignore if this should be regarded as just a C programming question and
shouldn't be here.
I currently use a bulky loop-based method to accomplish this, looking
for something more efficient. For example say I have a matrix BEFORE of
index and value columns and I want to remove rows with values of zero to
obtain matrix AFTER. Anybody know how to do this in a few lines without
looping?
BEFORE AFTER
1 34.58641 1 34.58641
2 0 3 42.54367
3 42.54367 4 46.27856
4 46.27856 5 49.85982
5 49.85982 6 53.29379
6 53.29379 7 56.58652
7 56.58652 8 59.74382
8 59.74382 9 62.77126
9 62.77126 10 65.67418
10 65.67418
Mark Fowler
Population Ecology Division
Bedford Inst of Oceanography
Dept Fisheries & Oceans
Dartmouth NS Canada
B2Y 4A2
Tel. (902) 426-3529
Fax (902) 426-9710
Email Mark.Fowler at dfo-mpo.gc.ca
Home Tel. (902) 461-0708
Home Email mark.fowler at ns.sympatico.ca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20130225/c4576041/attachment.html>
More information about the Users
mailing list