How to extract data from 3D table with indices

Hello,
I have some troubles working with 3D tables. In fact, i have a 3D matrix MT (N, 19, 3) and i‘m looking for indices for which [u v]=find (MT(:,16,:)==2) [u v]= 155 1 156 1 157 1 158 1 159 1 160 1 161 1 102 2 103 2 104 2 105 2 106 2 107 2 108 2 109 2 50 3 51 3 52 3 53 3 54 3 55 3 56 3 57 3
Once I get the indices, I want to extract datas form MT (:, 3, :) corresponding to these indices and store these datas that way 1 2 3 Data(155,3,1) Data(102,3,2) Data(50,3,3) Data(156,3,1) Data(103,3,2) Data(51,3,3) Data(158,3,1) Data(104,3,2) Data(52,3,3) Data(159,3,1) Data(105,3,2) Data(53,3,3) Data(160,3,1) Data(106,3,2) Data(54,3,3) Data(161,3,1) Data(107,3,2) Data(55,3,3) Data(108,3,2) Data(56,3,3) Data(109,3,2) Data(57,3,3)
Is there any way to this correctly please? Many thanks for considering my request,
PS: It's easiest to read on the attached file

5 commentaires

dpb
dpb le 4 Avr 2014
Can't read your request, sorry...format the code/data values such that it can be interpreted.
As a general comment, NB: that for >2D arrays find returns a linear index in the trailing dimensions for the second argument. To find the corresponding plane from that index of your find means you need to recast it to the size of the array via ind2sub
F Z
F Z le 6 Avr 2014
Thank you a lot for your feedback. I've already tried ind2sub to get the indices according to the array's size. However,i can't find the right manner to extract datas from the third slice of my initial matrix MT(N,19,3)according to the indices given by the ind2sub.
By the way, the attached pdf to my first post is helpuful i think to understand what i am looking for.
Thank you for considering my request
When you say MT (:, 3, :) you're looking at column 3. Let's say that columns are x. So you're basically looking at the Y-Z plane slicing through the volume at an x of 3.
You may find things that are in any Z plane, not just plane 3.
Plus you'll get a N by 1 by 3 array , not a 2D array so you may want to look into squeeze() in case you need it.
F Z
F Z le 6 Avr 2014
Thank you for your comment. In fact, if i slice through the volume at x=3,i will find o kind of [MT(:,3,1) MT(:,3,2)] MT(:,3,3)], right? N by 1 by 3 array. Still, i don't figure out how to get this N by 1 by 3 array with the indices given by ind2sub.
Sorry, i am a biginner.
Thank you for help,
Jan
Jan le 6 Avr 2014
@Fatzo: Please use the possibility to format your question properly. Making it harder to read the question is a bad idea.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Phased Array Design and Analysis dans Centre d'aide et File Exchange

Question posée :

F Z
le 4 Avr 2014

Commenté :

Jan
le 6 Avr 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by