Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Storing the address
Date: Sat, 31 Jan 2009 07:03:10 +0000 (UTC)
Organization: Battelle Energy Alliance (INL)
Lines: 32
Message-ID: <gm0t3e$n3r$1@fred.mathworks.com>
References: <glud5p$o60$1@fred.mathworks.com> <glum0q$1nr$1@fred.mathworks.com> <glupfd$fv2$1@fred.mathworks.com> <glvc1q$itr$1@fred.mathworks.com> <glvf7h$m2k$1@fred.mathworks.com> <gm0ht1$m2e$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 1233385390 23675 172.30.248.37 (31 Jan 2009 07:03:10 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 31 Jan 2009 07:03:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 688530
Xref: news.mathworks.com comp.soft-sys.matlab:515105


Seems like you should use a loop, but if you insist on a "vectorized" approach, here is one.



test = cat(3, { [11] [12] [];
                              [] [] [11];
                              [] [] [12];
                              [] [] [];
                              [] [] [] }, { [21] [22] [];
                                                         [] [] [21];
                                                         [] [] [22];
                                                         [] [] [];
                                                         [] [] [] } )

idx2 = repmat(sum(~cellfun(@isempty,test))>1,[size(test,1),1,1]);
test(~idx2) = {[]};
idx4 = ~cellfun(@isempty,test);
[rx,cx,px] = ind2sub(size(idx4),find(idx4));

rx_cx_px = [rx,cx,px]

rx_cx_px =

     2     3     1
     3     3     1
     2     3     2
     3     3     2




NZL0jRq_P[D`8YLZZj[jLdYPMjTSLXVqPZP_WWNTjj%ZXLL+SxL`jS_ZajM