I would like to compare the following given data set
a = '235 148 89 19 222';
b = '112 128 144 160 176';
c = '192 192 192 192 192';
d = '64 64 64 64 64';
with
y = [230 138 79 15 212];
Then calculate the correlation coefficient by comparing each of the given data set with y
. Then, display the string with the highest correlation coefficient found.
I can find it for calculating it for two values with the command
c = corrcoef( a, y );
c = abs(c(2,1));
but how do I iterate through each data set using a for loop and display the result with highest the corrcoef
?
Here is the piece of code which I have written, but I don't know how to proceed with the 'for loop'
a = '235 148 89 19 222';
b = '112 128 144 160 176';
c = '192 192 192 192 192';
d = '64 64 64 64 64';
y = '230 138 79 15 212';
s = {a;b;c;d};
s = cellfun(@strsplit, s, 'UniformOutput', false);
s = vertcat(s{:});
for i = 1:size(s,1)
end