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: Simple Problem to Ask
Replies: 5   Last Post: Jan 21, 2013 4:39 PM

Advanced Search

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

Posts: 3,892
Registered: 12/7/04
Re: Simple Problem to Ask
Posted: Jan 21, 2013 2:17 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Tuesday, January 22, 2013 8:04:05 AM UTC+13, dpb wrote:
> On 1/21/2013 11:39 AM, Mark Gul wrote:
>

> > Dear Friends
>
> >
>
> > I Have a simple problem to ask you.
>
> >
>
> > Headings={'A','C','D','E','AC','AD','AE','AC', ...
>
> 'CD','CE','AD','CD','DE','AE','CE','DE'}
>

> >
>
> > Data =
>
> > 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
>
> > 1 1 1 0 1 1 0 1 1 0 1 1 0 0 0 0
>
> > 0 1 0 1 0 0 0 0 0 1 0 0 0 0 1 0
>
> > 1 0 1 1 0 1 1 0 0 0 1 0 1 1 0 1
>
> > 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
>
> >
>
> > For each Heading, one column in sequence is represented.
>
> > Now, the problem is that I want to get unique headings as well as
>
> > according to unique headings, the same columns of Data in the above
>
> > dataset.
>
> >
>
> > If anyone knows some useful way, Please tell me, I will be highly thankful.
>
>
>
> As Roger says, it's certainly precisely clear what you're asking as the
>
> headings as given seem to be unique already (at least in the sense of no
>
> duplicates).
>
>
>
> I'm _guessing_ that perhaps you're looking for something that let's you
>
> find the column index/indices of a set of one or more heading values and
>
> the appropriate data associated w/ same. If so, then sotoo
>
>
>
> ix=findstr(Headings,'A'); % all locations w/ an 'A' as part of title
>
> y=data(:,ix); % the corresponding data columns
>
>
>
> --


My interpretation of what he wants is the columns corresponding to unique headings, whence:
[Hdum,indx]=unique(Headings);
indx=sort(indx); % needed because unique sorts the data
y=data(:,indx);



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.