Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: Text data save
Replies: 7   Last Post: Oct 14, 2013 5:09 PM

 Messages: [ Previous | Next ]
 dpb Posts: 9,662 Registered: 6/7/07
Re: Text data save
Posted: Oct 14, 2013 5:09 PM

On 10/14/2013 12:24 PM, Debela wrote:
> dpb <none@non.net> wrote in message <l3h4o0\$mqt\$1@speranza.aioe.org>...
...

>> Secondly, presuming it really is an array and you're looking for these
>> values by column inside the array, the above returns the first (and
>> only the first) of what may be multiple values that meet the criteria.
>> Is that what is wanted or do you need all values?

> Sorry about the confusion created due to this, yes it is an array as
> shown on the code. The code only returns the first , and basically I
> want similar thing, but I want all the first numbers in column. By the
> way this code works if I am only interested the one column.

Well, in a couple of steps...may be simpler to just use a loop since
can't write anonymous function to use the third (second optional) output
from find() to get the value directly. That would be a really, really,
nice feature....

Given a sample small array, the one for the >0.8 is as follows; salt to
suit for the minimum, obviously.

>> x
x =
0.8147 0.9058 0.1270
0.9134 0.6324 0.0975
0.2785 0.5469 0.9575
0.9649 0.1576 0.9706
0.9572 0.4854 0.8003
>> n=size(x,2)
n =
3
>> ix=accumarray([1:n]',[1:n]',[],@(ix)
find(x(:,ix)>0.8*max(x(:)),1,'first'))'
ix =
1 1 3
>> v=accumarray([1:n]',[1:n]',[],@(i) x(ix(i),i))'
v =
0.8147 0.9058 0.9575
>>

--

Date Subject Author
8/20/13 Bizuayehu Mohammed
8/20/13 Steven Lord
9/9/13 Bizuayehu Mohammed
9/9/13 dpb
10/14/13 Bizuayehu Mohammed
10/14/13 dpb
10/14/13 Bizuayehu Mohammed
10/14/13 dpb