Iterate over a specific vector that is part of a cell

I have several cells A{1} ... A{n} . Each cell contains a vector a ; therefore, A{1}.a ... A{n}.a . So, is there an easy way (for example, one row) to access an element from a ie g = A{:}.a(2) from all cells? g now a vector that contains the second element of a from all a cells.

+4
source share
1 answer

How about cellfun :

 cellfun(@(x) xa(2), A) 
+5
source

Source: https://habr.com/ru/post/1483482/


All Articles