Hello I am trying to create a Fully Connected Neural Network to classify feature data. I have input data as a 4000x2 cell containing in column 1 the input features as 12x5 double (12 features with 5 values for each), and in column 2 the response lables (0 or 1). Before I input data to the network I arrange column 1 and 2 in seperate variables as a x = 4000x1 cell (with features) and y = 4000x1 categorical (with responses). However, when I run trainNetwork I get the following error message: Error using trainNetwork (line 165) Invalid training data. If the network outputs sequences, then the responses must be a cell array of categorical sequences, or a categorical sequence. I arrange and convert resonses from the input cell (4000x2) to a categorical by using categorical : yTemp = inputDataCell(1:4000,2); y = categorical(cell2mat(yTemp)); Question: How is my cell array of categorical responses not a categorical sequence and how do I make it so?
Kshitij Singh answered .
2025-11-20
yTemp = inputDataCell(1:4000,2);
yCategory = categorical(cell2mat(yTemp));
for i = 1:length(yCategory)
tempClassNum = yCategory(i,1);
tempClassMatrix(1,1:5) = tempClassNum;
yCC(i) = {tempClassMatrix(:,:)};
end
ySequence = yCC';