Path: news.mathworks.com!not-for-mail
From: "us " <us@neurol.unizh.ch>
Newsgroups: comp.soft-sys.matlab
Subject: Re: multidimensional indexing
Date: Tue, 13 May 2008 08:12:02 +0000 (UTC)
Organization: Universit&#228;tsSpital Z&#252;rich
Lines: 17
Message-ID: <g0bigi$cp3$1@fred.mathworks.com>
References: <g0b6eb$18j$1@fred.mathworks.com>
Reply-To: "us " <us@neurol.unizh.ch>
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 1210666322 13091 172.30.248.37 (13 May 2008 08:12:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 13 May 2008 08:12:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 11
Xref: news.mathworks.com comp.soft-sys.matlab:468077


"Darius ":
<SNIP repeating his/her ND-diag...

one of the many solutions

% the data
     m=reshape(1:27,[3,3,3])
% the engine
     r=ones(3,1)*arrayfun(@(x) m(x,x,x),1:3)
%{
     r=
     1 14 27
     1 14 27
     1 14 27
%}

us