Trying to build a table in Matlab to build a simple 3 by x table.
I have a larger table that has a series of serial numbers for example:
I am trying to store those same numbers in the first column of my new table Compensation_Table under the variable name Serial_Number. See my below script as an example of what I am doing.
SN = 0;
WT = 0;
CM = 0;
SerialNumber = {};
WearTime = {};
Commands = {};
Compensation_Table = table(SerialNumber, WearTime, Commands);
Compensation_Table.Properties.VariableNames = {'Serial_Number', 'Wear_Time', 'Commands'};
for SN_ind = 1:height(Data_Analysis_Table)
SN = cell2mat(Data_Analysis_Table.Serial_Number(SN_ind));
Compensation_Table.SerialNumber(SN_ind) = SN;
Compensation_Table.WearTime(SN_ind) = WT;
Compensation_Table.Commands(SN_ind) = CM;
end
However when I do so I am presented with this error.
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
Not sure why this is occurring?
