Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: find elements to include page indices
Date: Thu, 24 Jul 2008 08:00:24 +0000 (UTC)
Organization: Universit&#228;tsSpital Z&#252;rich
Lines: 27
Message-ID: <g69cqo$gsb$1@fred.mathworks.com>
References: <g677t2$j92$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1216886424 17291 172.30.248.37 (24 Jul 2008 08:00:24 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 24 Jul 2008 08:00:24 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 11
Xref: news.mathworks.com comp.soft-sys.matlab:481433



"Dave Brackett"
<SNIP looking for his/her bookmarks...

> I have a matrix of size [1,16,50] and want to find the
> positions of the non-zero and zero elements within...

one of the many solutions

% the data
     m=zeros([2,3,4]);
     m(1,1,1)=nan;
     m(2,2,3)=nan;
     m(2,3,4)=nan;
% the engine
     lix=find(m);
     ix=cell(1,ndims(m));
     [ix{1:end}]=ind2sub(size(m),lix);
     r=cat(2,ix{:});
% the result
     disp(r);
%{
     1 1 1
     2 2 3
     2 3 4
%}

us