|
From: | Tom Holroyd |
Subject: | Re: How doyou vectorize pulling values out of a matrix? |
Date: | Mon, 24 Jul 2006 20:24:19 -0400 (EDT) |
Assume there is mymatrix [500,500] and I wish to retrieve 100 certain values from there.
Well, if a is 500,500, then a(:) is 250000 elements.
The specific indices are stored in two vectors Xindex and Yindex that are each [1,100]
You can say "a(Xindex + Yindex * 500)" (or the other way around, I'm not sure). I hope this doesn't involve much copying.
[Prev in Thread] | Current Thread | [Next in Thread] |