Feel free to write one! Unlike Matlab, you don't have to descend into C to provide basic functionality; a pair of loops will often suffice. I suspect this may be the main reason there isn't a cell2mat in base, it's usually easy enough (and often clearer, with fewer trips needed to read documentation) to do what you want directly.
However, cell2mat does keep coming up. By all means, take a stab at the general problem, and then post as a package or submit to base and see if folks are interested. (I'd start with the standalone option, though.) --Tim On Sunday, September 21, 2014 01:38:25 AM Staro Pickle wrote: > Thank you for help. > > I have checked the docs, no direct substitution for "cell2mat" :( > > On Sunday, September 21, 2014 1:01:22 PM UTC+8, Don MacMillen wrote: > > I haven't seen it, but that doesn't mean it's not there. Maybe time to > > hit readthedocs? > > > > On Saturday, September 20, 2014 9:48:02 PM UTC-7, Staro Pickle wrote: > >> There is no automatic way, like the "cell2mat" command in matlab? > >> > >> On Sunday, September 21, 2014 12:42:44 PM UTC+8, Don MacMillen wrote: > >>> short answer is hvcat((2,2), A...) but make certain it is doing the > >>> concatenation in the order you really want, else call it out > >>> specifically > >>> as hvcat((2,2), A[2,1], A[1,1], A[2,2], A[1,2]) for example. > >>> > >>> On Saturday, September 20, 2014 8:34:32 PM UTC-7, Staro Pickle wrote: > >>>> I define a matrix using cell, like: > >>>> A = cell(2,2) > >>>> b = ones(2,2) > >>>> A[1,1] = b > >>>> A[1,2] = b > >>>> A[2,1] = b > >>>> A[2,2] = b > >>>> > >>>> Then I want to make A a 4*4 2-D array: > >>>> 1.0 1.0 1.0 1.0 > >>>> 1.0 1.0 1.0 1.0 > >>>> 1.0 1.0 1.0 1.0 > >>>> 1.0 1.0 1.0 1.0 > >>>> > >>>> How to do this?