Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
position indexes 3D matrix

Subject: position indexes 3D matrix

From: rodrikas

Date: 21 Apr, 2010 12:40:17

Message: 1 of 3

hi,

I am trying to obtain the position of the values higher than a threshold (in terms of indexes (i,j,k))within a 3D matrix.

In a matrix 2D I use the command "[row,cols]=find..." but I don´t know if this can be done in a 3D matrix.

Any help is appreciated. Thanks in advance

Rodrigo

Subject: position indexes 3D matrix

From: Jos (10584)

Date: 21 Apr, 2010 13:16:06

Message: 2 of 3

rodrikas <carballo.rodrigo@gmail.com> wrote in message <1234565711.48094.1271853648099.JavaMail.root@gallium.mathforum.org>...
> hi,
>
> I am trying to obtain the position of the values higher than a threshold (in terms of indexes (i,j,k))within a 3D matrix.
>
> In a matrix 2D I use the command "[row,cols]=find..." but I don´t know if this can be done in a 3D matrix.
>
> Any help is appreciated. Thanks in advance
>
> Rodrigo


Take a look at linear indices and IND2SUB

M = ceil(10*rand(5,4,3)) ;
idx = find(M > 5) % linear indices
[ri,ci,pi] = ind2sub(size(M), idx) sub indices

hth
Jos

Subject: position indexes 3D matrix

From: Sean

Date: 21 Apr, 2010 13:18:05

Message: 3 of 3

rodrikas <carballo.rodrigo@gmail.com> wrote in message <1234565711.48094.1271853648099.JavaMail.root@gallium.mathforum.org>...
> hi,
>
> I am trying to obtain the position of the values higher than a threshold (in terms of indexes (i,j,k))within a 3D matrix.
>
> In a matrix 2D I use the command "[row,cols]=find..." but I don´t know if this can be done in a 3D matrix.

idx = find...(my_matrix)
[rows cols pags] = ind2sub(size(my_matrix),idx);

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us