The Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 9,850
Registered: 6/7/07
Re: Text data save
Posted: Oct 14, 2013 5:09 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 10/14/2013 12:24 PM, Debela wrote:
> dpb <> wrote in message <l3h4o0$mqt$>...

>> 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 =
>> ix=accumarray([1:n]',[1:n]',[],@(ix)
ix =
1 1 3
>> v=accumarray([1:n]',[1:n]',[],@(i) x(ix(i),i))'
v =
0.8147 0.9058 0.9575


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.