MATLAB: Cell array to Matrices

cell arraysMATLAB

Dear Matlab users, I have a cell array B 1×512 . now I want to divide every cell to a new matrix. So I will have 512 matrices.I prefer their names to be C1,C2…,C512. every "C" matrix is 10001×3 matrix.
I am using cell2mat option, but I want to write a loop which I cannot do it
C1=cell2mat(B(1))
thi is working just for one, I do not want to do it one-by-one.
Thanks in advance,

Best Answer

You already have your C1, C2, ..., C512 in a very convenient container making it very easy to access: your cell array. Assuming your cell array is called C and not B, to get C1:
C{1}
to get C2:
C{2}
etc.
Creating numbered variables is an extremely bad idea. It's just going to make your code more complicated, slower, harder to debug for no gain whatsoever. See tutorial-why-variables-should-not-be-named-dynamically-eval for a complete explanation
What it looks like from your cell2mat(B(1)) is that you don't know how to access the data in a cell array. See the tutorials on the cell array page to learn the difference between () and {} indexing.