This is more of an observation than a question, but it took me two days to figure it out.
I am pre-allocating space for an array, to save time. The array is about 50,000 rows long, and pre-allocating the cells saves a lot of time processing, as opposed to "growing" the array one row at a time. However, if some of the row cells are not populated, the sortrows function will crash when it gets to the rows containing empty cells.
    {0x0 double} {0x0 double} {0x0 double} {0x0 double} {0x0 double} 
    {0x0 double} {0x0 double} {0x0 double} {0x0 double} {0x0 double} 
    {0x0 double} {0x0 double} {0x0 double} {0x0 double} {0x0 double} 
    {0x0 double} {0x0 double} {0x0 double} {0x0 double} {0x0 double} 
    {0x0 double} {0x0 double} {0x0 double} {0x0 double} {0x0 double} 
output((1:3),(1:5)) = {'1'}
    {'1'       } {'1'       } {'1'       } {'1'       } {'1'       } 
    {'1'       } {'1'       } {'1'       } {'1'       } {'1'       } 
    {'1'       } {'1'       } {'1'       } {'1'       } {'1'       } 
    {0x0 double} {0x0 double} {0x0 double} {0x0 double} {0x0 double} 
    {0x0 double} {0x0 double} {0x0 double} {0x0 double} {0x0 double} 
    Cell elements must be character arrays
I'll admit, a more careful job of coding could prevent this from happening. However, it would be nice if the sort and sortrows functions could just take this in stride, rather than crashing.