MATLAB: Accessing elements of an array of lists

arrayslists

Hi,
I am using MATLAB in conjuction with simulation software that grants an array of data in the form "domain, E1, E2, E3". The array is about 200k elements long, with each of these 4 variables per element.
ex. V3PH = [domain1,E11,E21,E31
domain2,E12,E22,E32
domain3, E13, E23, E33
domain4, E14, E24, E34,
etc….]
If I am looking to create an array of all the E1 element only.. How would I do this?
Ive tried using the following code:
for n=1:200000
Va(n) = V3PH(n:1:2); %Array from all E1 elements
….
….
end
I know the indexing isn't correct in the above code, but I'd appreciate some tips on how to achieve this. Thanks.

Best Answer

V3PH(:, 2)
provided that your "vectors" are not cell arrays.
If your vectors are cell arrays then
cellfun(@(c)c(:,2), V3PH)