Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Deleting value in a matrix based on the row in another matrix
Date: Sun, 9 May 2010 23:09:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 23
Message-ID: <hs7fag$90p$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1273446544 9241 172.30.248.38 (9 May 2010 23:09:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 9 May 2010 23:09:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2346709
Xref: news.mathworks.com comp.soft-sys.matlab:634061

Good day,
I wrote the code below to open a series of files, find the standard deviation of each column in the file (3) and and add each standard deviation to a new matrix. It's not perfect, I know. The problem is that some files in the series do not exist or have different names. These do not matter as I am allowed to safely skip some files. But I need to delete those values form the matrix [t] based on the matrix [point] as [point] will have all zeros rows for the missing files.

I'm just starting out in matlab and I wrote this code based on ideas from this forum. I know the problem is with this line of code
 t(:,point == 0,2) = [];
as the other work fine when I delete it. Any suggestions on the correct code will be appreciated.
Thanks
P.S I know what the code "point(all(point==0,2),:) = [];" does but what does "point==0,2" do?

point = zeros(1000,3);
    t = 41000:1000:379500;
    n = length(t);
        for i = 1:n;
            x = ['trail',num2str(t(i),'%08.0f'),'.dat'];
            g = dir (x);
            if ~isempty(g)
              M = dlmread(x,'',1,0);
              s = std (M,1);
              point(i,:) = s;  
            end
        end
     t(:,point == 0,2) = [];
     point(all(point==0,2),:) = [];