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: how to find unique rows and calculate the average.
Replies: 9   Last Post: Apr 12, 2013 6:31 PM

Advanced Search

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

Posts: 8,232
Registered: 6/7/07
Re: how to find unique rows and calculate the average.
Posted: Apr 10, 2013 10:50 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 4/10/2013 4:10 PM, Alan Hitch wrote:
...

> Thanks for responding. I neglected to tell you that the data is a cell
> array with different data types and textscan only works with double or
> string. I read the data in using xlsread and was using the raw data. I
> am relatively new to MatLab. How do I convert the cell array into a
> double or string? I tried using cell2mat but the contents of my
> cellarray are different data types.


OK, it just dawned on me--your problem is trying to use RAW; use TEXT as
the C{1} cell in my example and NUM as the C{2}. Since XLSREAD returns
the numeric fields as a double array instead of cell, just dispense w/
the curly brackets to dereference the cell contents and just use the
subscripting expressions directly into NUM. (Of course, use whatever
variable names you wish instead of the ML placeholders...)

--




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.