http://www.mathworks.com/matlabcentral/newsreader/view_thread/325954
MATLAB Central Newsreader  Simple Problem to Ask
Feed for thread: Simple Problem to Ask
enus
©19942015 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Mon, 21 Jan 2013 17:39:09 +0000
Simple Problem to Ask
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325954#895916
Mark Gul
Dear Friends<br>
<br>
I Have a simple problem to ask you.<br>
<br>
Headings={'A','C','D','E','AC','AD','AE','AC','CD','CE','AD','CD','DE','AE','CE','DE'}<br>
Data =<br>
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1<br>
1 1 1 0 1 1 0 1 1 0 1 1 0 0 0 0<br>
0 1 0 1 0 0 0 0 0 1 0 0 0 0 1 0<br>
1 0 1 1 0 1 1 0 0 0 1 0 1 1 0 1<br>
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1<br>
<br>
For each Heading, one column in sequence is represented. <br>
<br>
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.<br>
<br>
If anyone knows some useful way, Please tell me, I will be highly thankful.<br>
<br>
Regards<br>
MG

Mon, 21 Jan 2013 18:18:08 +0000
Re: Simple Problem to Ask
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325954#895917
Roger Stafford
"Mark Gul" wrote in message <kdjuft$40q$1@newscl01ah.mathworks.com>...<br>
> Dear Friends<br>
> <br>
> I Have a simple problem to ask you.<br>
> <br>
> Headings={'A','C','D','E','AC','AD','AE','AC','CD','CE','AD','CD','DE','AE','CE','DE'}<br>
> Data =<br>
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1<br>
> 1 1 1 0 1 1 0 1 1 0 1 1 0 0 0 0<br>
> 0 1 0 1 0 0 0 0 0 1 0 0 0 0 1 0<br>
> 1 0 1 1 0 1 1 0 0 0 1 0 1 1 0 1<br>
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1<br>
> <br>
> For each Heading, one column in sequence is represented. <br>
> <br>
> 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.<br>
> <br>
> If anyone knows some useful way, Please tell me, I will be highly thankful.<br>
> <br>
> Regards<br>
> MG<br>
          <br>
Your problem may be simple but it is not so simple to understand your description of it. Please try again to describe what it is you are asking when you say "get unique headings as well as according to unique headings, the same columns of Data in the above dataset." It would be better to say too much than too little. I can only make wild guesses at your meaning as things stand now.<br>
<br>
Roger Stafford

Mon, 21 Jan 2013 19:04:05 +0000
Re: Simple Problem to Ask
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325954#895923
dpb
On 1/21/2013 11:39 AM, Mark Gul wrote:<br>
> Dear Friends<br>
><br>
> I Have a simple problem to ask you.<br>
><br>
> Headings={'A','C','D','E','AC','AD','AE','AC', ...<br>
'CD','CE','AD','CD','DE','AE','CE','DE'}<br>
><br>
> Data =<br>
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1<br>
> 1 1 1 0 1 1 0 1 1 0 1 1 0 0 0 0<br>
> 0 1 0 1 0 0 0 0 0 1 0 0 0 0 1 0<br>
> 1 0 1 1 0 1 1 0 0 0 1 0 1 1 0 1<br>
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1<br>
><br>
> For each Heading, one column in sequence is represented.<br>
> Now, the problem is that I want to get unique headings as well as<br>
> according to unique headings, the same columns of Data in the above<br>
> dataset.<br>
><br>
> If anyone knows some useful way, Please tell me, I will be highly thankful.<br>
<br>
As Roger says, it's certainly precisely clear what you're asking as the <br>
headings as given seem to be unique already (at least in the sense of no <br>
duplicates).<br>
<br>
I'm _guessing_ that perhaps you're looking for something that let's you <br>
find the column index/indices of a set of one or more heading values and <br>
the appropriate data associated w/ same. If so, then sotoo<br>
<br>
ix=findstr(Headings,'A'); % all locations w/ an 'A' as part of title<br>
y=data(:,ix); % the corresponding data columns<br>
<br>


Mon, 21 Jan 2013 19:17:59 +0000
Re: Simple Problem to Ask
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325954#895925
TideMan
On Tuesday, January 22, 2013 8:04:05 AM UTC+13, dpb wrote:<br>
> On 1/21/2013 11:39 AM, Mark Gul wrote:<br>
> <br>
> > Dear Friends<br>
> <br>
> ><br>
> <br>
> > I Have a simple problem to ask you.<br>
> <br>
> ><br>
> <br>
> > Headings={'A','C','D','E','AC','AD','AE','AC', ...<br>
> <br>
> 'CD','CE','AD','CD','DE','AE','CE','DE'}<br>
> <br>
> ><br>
> <br>
> > Data =<br>
> <br>
> > 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1<br>
> <br>
> > 1 1 1 0 1 1 0 1 1 0 1 1 0 0 0 0<br>
> <br>
> > 0 1 0 1 0 0 0 0 0 1 0 0 0 0 1 0<br>
> <br>
> > 1 0 1 1 0 1 1 0 0 0 1 0 1 1 0 1<br>
> <br>
> > 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1<br>
> <br>
> ><br>
> <br>
> > For each Heading, one column in sequence is represented.<br>
> <br>
> > Now, the problem is that I want to get unique headings as well as<br>
> <br>
> > according to unique headings, the same columns of Data in the above<br>
> <br>
> > dataset.<br>
> <br>
> ><br>
> <br>
> > If anyone knows some useful way, Please tell me, I will be highly thankful.<br>
> <br>
> <br>
> <br>
> As Roger says, it's certainly precisely clear what you're asking as the <br>
> <br>
> headings as given seem to be unique already (at least in the sense of no <br>
> <br>
> duplicates).<br>
> <br>
> <br>
> <br>
> I'm _guessing_ that perhaps you're looking for something that let's you <br>
> <br>
> find the column index/indices of a set of one or more heading values and <br>
> <br>
> the appropriate data associated w/ same. If so, then sotoo<br>
> <br>
> <br>
> <br>
> ix=findstr(Headings,'A'); % all locations w/ an 'A' as part of title<br>
> <br>
> y=data(:,ix); % the corresponding data columns<br>
> <br>
> <br>
> <br>
> <br>
<br>
My interpretation of what he wants is the columns corresponding to unique headings, whence:<br>
[Hdum,indx]=unique(Headings);<br>
indx=sort(indx); % needed because unique sorts the data<br>
y=data(:,indx);

Mon, 21 Jan 2013 21:31:14 +0000
Re: Simple Problem to Ask
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325954#895932
dpb
On 1/21/2013 1:17 PM, TideMan wrote:<br>
...<br>
<br>
> My interpretation of what he wants is the columns corresponding to unique headings,...<br>
<br>
Excepting as I noted they're _already_ unique...at least in the example <br>
so it seems silly to post that when asking. My interpretation is this <br>
is a "failure to communicate" likely attributable to OP being nonnative <br>
English speaker....<br>
<br>


Mon, 21 Jan 2013 21:39:42 +0000
Re: Simple Problem to Ask
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325954#895934
dpb
On 1/21/2013 3:31 PM, dpb wrote:<br>
> On 1/21/2013 1:17 PM, TideMan wrote:<br>
> ...<br>
><br>
>> My interpretation of what he wants is the columns corresponding to<br>
>> unique headings,...<br>
><br>
> Excepting as I noted they're _already_ unique......<br>
<br>
Ooops....in rereading I see I somehow missed the ones that are <br>
duplicates. Age and poorer eyesight seems to cause that more often than <br>
it should, any more. :(<br>
<br>
W/ that correction of what the original posting actually had I'll agree <br>
you probably do have the right interpretation.<br>
<br>
