Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

Topic: Is there a better way to count number of occurances of string when grouping?
Replies: 6   Last Post: Mar 20, 2012 6:11 PM

Advanced Search

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

Posts: 854
Registered: 12/7/04
Re: Is there a better way to count number of occurances of string when grouping?
Posted: Mar 20, 2012 6:11 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

> I have a dataset svdatm with columns:
>
> % dnum (datenum)
> % symid (symbol id - a cell array)
>
> I would like to find the count or number of elements (i.e., symid)
> that occur each day.


In addition to the other suggestions, consider trying

crosstab(svdatm.dnum, svdatm.symid)

I don't know if it would be any faster, and it might require too much memory
if there are lots of unique symid values, but it's a thought.

-- Tom




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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.