Switch to unified view

a b/Semantic Features/GetAveragedMatrix.m
1
function [ AveragedMatrix, instanceOrder ] = GetAveragedMatrix( InputMatrix, ratingRow, instanceID )
2
%GetAveragedRows Converts matrix from raw format to averaged format
3
%   Takes an X or Y matrix and ratingRow(which describes how many rows per
4
%   nodule) and averages each set of rows into a single row. 
5
6
j = 1;
7
i = 1;
8
del = 3;
9
while i <= size(InputMatrix,1)
10
    instanceOrder(j,:) = zeros(1,4); %Make a new empty row
11
    if i == ratingRow(3)
12
        del = del-1;
13
    end
14
    if i == ratingRow(2)
15
        del = del-1;
16
    end
17
    if i == ratingRow(1)
18
        del = del-1;
19
    end
20
    instanceOrder(j,1:1+del) = instanceID(i:i+del)';
21
    AveragedMatrix(j,:) = mean(InputMatrix(i:i+del,:),1);
22
    i = i + del + 1;
23
    j = j+1;
24
end