Use mat2cell as an engine. I assume that you want to aggregate the results of the second column of the patient profile array depending on the first column. If the profile is in a PP array:
counts = [6;4;10];
C = mat2cell(PP(:,2),counts)
C =
[ 6x1 double]
[ 4x1 double]
[10x1 double]
See that this step completed the task of extracting data into individual cells.
C{:}
ans =
2
3
-2
1
3
2
ans =
-1
-3
0
-2
ans =
2
2
1
3
2
-1
-2
-3
-2
-2
PP , PP. , , , - , . , .
counts = accumarray(PP(:,1),1)
counts =
6
4
10
, , (1: 3), .
user85109