help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: abstracting n-dimensional subscripting


From: Jordi Gutiérrez Hermoso
Subject: Re: abstracting n-dimensional subscripting
Date: Tue, 10 May 2011 21:15:39 -0500

On 10 May 2011 20:04, G B <address@hidden> wrote:
> If I have a 2D matrix M, and vector [j,k], I want M(j,k).
> If I have a 3D matrix M, and vector [j,k,m], I want M(j,k,m).

If n = [j,k] or n = [j,k,m], try

     M(num2cell(n){:})

Note this trick won't work in Matlab because it doesn't allow indexing
temporaries.

HTH,
- Jordi G. H.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]