Suppose you have the N by M matrix A. I would randomly permute positions from 1:N and then group them into k partitions. Follows the code.
% Sample inputs
% Number of partitions
% Scatter row positions
% Bin the positions into k partitions
edges = round(linspace(1,N+1,k+1));
Now you can "physically" partition A, or apply your code to the segments of without actually separating into blocks.
% Partition A
prtA = cell(k,1);
for ii = 1:k
idx = edges(ii):edges(ii+1)-1;
prtA{ii} = A(pos(idx),:);
end
EDIT
You can also avoid the loop, but in that case you have to build a group index that points the row to which partition it belongs and then apply accumarray() to execute your code on the partitions.