I want to extract some certain values from a simple cell-array, which looks like:
CellExample{1} = [1,54,2,3,4]
CellExample{2} = [1,4,1,92,9,0,2]
...
And I have an additional array that tells me which element I want to extract from each Cell element. The array is as long as the cell:
ArrayExample = [2,4,...]
Basically, I want an array that says:
Solution(1) = CellExample{1}(ArrayExample(1)) = 54
Solution(2) = CellExample{2}(ArrayExample(2)) = 92
I have thought of using cellfun, but I have still some troubles using it correctly, e.g.:
cellfun(@(x) x{:}(ArrayExample),CellExample,'UniformOutput',false)
cellfun()already passes the content of the cell to the anonymous function, hence no need for{:}