MATLAB: How to add a 52×1 data set to 52×5 matrix.

arrayscell arraydata structuresmatrices

I have a set of data (influenza_a) that I am trying to add to a data matrix (data_matrix):
data_matrix = zeros(52, 5);
influenza_a = data{:, 6} + data{:, 8};
data_matrix{ :, i } = influenza_a;
However, it returns the error:
Cell contents assignment to a non-cell array object.
So how do I add the values of influenza_a to a column in the data_matrix?
Here is my full code:
directory = ('/ParentDirectory/Data/');
csvfiles = dir(fullfile(directory,'*.csv'));
data_matrix = zeros(52, 5);
iter = 0;
for file = 1:numel(csvfiles)
iter = iter + 1;
delimiter = ',';
startRow = 2;
formatSpec = '%f%f%f%f%f%f%f%f%f%f%f%[^\n\r]';
filename = fullfile(directory, csvfiles(file).name);
fileID = fopen(filename,'r');
if fileID < 0
error('Failed to open file %s', filename);
end
data = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'HeaderLines' ,startRow-1, 'ReturnOnError', false);
fclose(fileID);
influenza_a = data{:, 6} + data{:, 8};
data_matrix{:, file} = influenza_a;

Best Answer

data_matrix(:, file) = influenza_a;