title: 3D cell arrays in matlab
body: <p>I am currently working using matlab, I have uploaded a csv file into a cell array that I have named B. What I now wish to do is to input the information of B into a 3-D cell array, the 3rd dimension of the array being the first column of B which are strings ranging from "chr1" to "chr24". The full length of B is m, and the maximum length of any "chr" is maxlength. I doubt that this is the best way of going about it but here is my code:</p>
  
  <pre><code>for j = 1:m ,
   Ind = findstr(B{1}{j}, 'chr');
   Num = B{1}{j}(Ind+3:end-1);
   cnum = str2num(Num);
  for i = 1:24,
      if cnum == i; 
          for k = 2:9 ,
              for l = 1:maxlength ,
  
              C{l}{k}{i} = B{k}{j};
  
              C{l}{k}{i}
              end
           end   
        end
     end
  end
  </code></pre>
  
  <p>The 3-D array that comes out of this does not match the corresponding values in the initial array. I also want to know if this is the right way to create a 3-D array, I can't seem to find anything on the matlab website about them.
  Thanks</p>