From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Cancelling matrix rows
Date: Sun, 14 Apr 2013 21:15:16 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 33
Message-ID: <kkf694$ddd$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1365974116 13741 (14 Apr 2013 21:15:16 GMT)
NNTP-Posting-Date: Sun, 14 Apr 2013 21:15:16 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 4216716
Xref: comp.soft-sys.matlab:793505

I'm after a way of cancelling "non minimal" rows of a matrix which contain all the non zero terms of a previous row plus more.

For example
a=[ 1, 2, 0;
       3, 4, 5;
       1, 2, 6]

Row 3 of 'a' should be cancelled as a row containing only the values 1 and 2 exists above it.

My current coding uses a for loop to compare each row to every other row using an 'ismember' or all the non zero terms in that row. Any other row that returns a true is member statement is deleted. However the final problem has the potential to have over a million rows meaning this for loop takes an unfeasible amount of time to run.

Does anyone have any ideas on how to speed this process up or take a different approach?

Once sorted into ascending order of number of non zero terms my current coding is:

for R=1:N; %Selects row of matrix
    TF=WF(WF~=0); %Produces array of non zero terms in row
    for X=(R+1):N; %Compares above row to all rows below in the sorted matrix
        if ismember([TF(1,:)],Phases_Final(X,:))==[(ones(1,size(TF,2)))];

Any help is appreciated.