Hi, the issue may occur because MATLAB's “trainNetwork” function expects the input image to be in a 4D format: (Height, Width, Channels, Batch Size). Since your trained network was designed with an image input layer (imageInputLayer([16 16 1])), it requires the input image to match this format. 
 Please refer to this code for implementation on dummy data 
% Define Layers 
layers = [ 
    imageInputLayer([16 16 1])   
    convolution2dLayer(3, 8, 'Padding', 1) % Use numeric padding instead of 'same' 
    reluLayer 
    maxPooling2dLayer(2, 'Stride', 2) 
    fullyConnectedLayer(10)   
    softmaxLayer 
    classificationLayer]; 
% Define Training Options  
options = trainingOptions("sgdm", ... 
    "MaxEpochs", 5, ... 
    "MiniBatchSize", 32, ... 
    "Verbose", false);  
% Generate Random Binary Training Data (1000 samples) 
numTrain = 1000; 
trainImages = randi([0, 1], 16, 16, 1, numTrain); % 4D array (Height, Width, Channels, Batch) 
trainLabels = categorical(randi([0, 9], numTrain, 1)); % Labels from 0 to 9 
% Train Network 
net = trainNetwork(trainImages, trainLabels, layers, options); 
% Test with a Random 16x16 Image 
testImage = randi([0, 1], 16, 16, 1); % Binary test image 
testImage = reshape(testImage, [16 16 1 1]); % Ensure 4D input format 
predLabel = classify(net, testImage); 
disp("Predicted Label: " + string(predLabel)) 


