catcell.m 522 B

12345678910111213141516171819202122232425262728
  1. function m = catcell(dim,m)
  2. % function m = catcell(dim,m)
  3. %
  4. % <dim> is the dimension to concatenate along
  5. % <m> is a cell matrix
  6. %
  7. % simply return cat(dim,m{:}). this function is useful because
  8. % MATLAB doesn't provide an easy way to apply "{:}" to an
  9. % arbitrary matrix.
  10. %
  11. % example:
  12. % isequal(catcell(2,{1 2 3}),[1 2 3])
  13. m = cat(dim,m{:});
  14. % THIS SEEMED TO FAIL AS A WAY OF SAVING MEMORY
  15. % f = [];
  16. % for p=1:numel(m)
  17. % if p == 1
  18. % f = m{p};
  19. % else
  20. % f = cat(dim,f,m{p});
  21. % end
  22. % m{p} = [];
  23. % end