MATLAB: I have N samples of training data and M samples of test data, how i combine it together to make it MxN samples.

cell combine

testdata 40X1 cell
traindat 80X1 cell
train_label 80X1 double
I have N samples of training data and M samples of test data, how i combine it together to make it MxN samples. The rows, here, represent each sample and the columns the different types of features detected from a sample. also i want to add an extra column at LAST of the data (preferably): This column should represent the desired labels for the data.

Best Answer

Following code shows how to convert the cell array from your code to the table as generated by fishertable = readtable('fisheriris.csv')
load('db3.mat');
testdata = cell2mat(reduced_testdata')';
testdata_table = array2table(testdata, ...
'VariableNames', ...
{'SepalLength', 'SepalWidth', 'PetalLength', 'PetalWidth'});
sample_labels = repmat("abcd", 40, 1); % creating random data to fill last column
% you should use your testlabels
testdata_table = addvars(testdata_table, sample_labels, ...
'NewVariableNames', 'Species');
Related Question