2010-09-27 15 views

Odpowiedz

16

Nie ma wbudowaną funkcję, ale jest to dość łatwe z kombinacją Fold i Partition:

In[47]:= x1 = RandomReal[{0, 1}, {3, 4, 5}]; 

In[48]:= dims = Dimensions[x1] 

Out[48]= {3, 4, 5} 

In[49]:= x2 = Fold[Partition, Flatten[x1], Most[Reverse[dims]]]; 

In[50]:= x1 == x2 

Out[50]= True 
2

Prawdopodobnie chcesz Partition[] lub jednego z jego krewnych.