MATLAB: How to extract data from all matrixes of a cell array

cell

I have a cell array 1×23 and every matrix contains 1×921600 and they're all same size but i only need to extract data from all the matrixes from array 1 until 456000 and again from 456000 until 764500. how can i do that ?

Best Answer

For cell array "C"
newArray = cellfun(@(a){{a(1,1:456000);a(1,456000:764500)}},C);
newArray = [newArray{:}];
newArray is a 2xn cell array of row vectors where row 1, newArray(1,:), are the values 1:456000 and row 2, newArray(2,:), are values 456000:764500
newArray =
2×23 cell array
Columns 1 through 3
{1×456000 double} {1×456000 double} {1×456000 double} . . . . .
{1×308501 double} {1×308501 double} {1×308501 double} . . . . .