Hello everyone!
I have a pretty simple task, but I cannot come up with a simple solution. All my ideas seem way to complicated. Here is what I want to do:
I have a cell array C containing vectors of equal length or empty cells:
C = {[1 2 3]; []; []; [5 6 7]; []};
Now I want to get a specific element, for example the second element, of each cell and write it into a new variable A. If the cell is empty I just want to write empty in the corresponding cell in A:
So if I wanted to get the second element I would expect A to look like this:
A = [2] [] [] [6] []
Thanks in advance!
EDIT
Well, maybe there is not such an obvious solution for this. So I'll just stick to an 'if' and a 'for' loop.
Best Answer