Hi, I've implemented the given matlab code to classify
emotions, age, and gender of the subjects. The Face.mat dataset includes 12 images of 6 different subjects. For
each subjects we have 2 samples of 6 different emotions. Use one of each samples in your training
dataset and the other one in your testing dataset. This way you would have 36 images in the training
dataset and 36 images in the testing dataset.
Goal: To classify the gender (2 classes: M, F), emotions (6 classes: angry, disgust, neutral, happy, sad,
surprised) and age (3 classes: Young, Mid age, Old). Using a linear classifier. You should label your
training and testing data for each of the classification problem separately. So, These are the variables I'm gettting  the following error: >> project_4
Error using  * 
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first
matrix matches the number of rows in the second matrix. To operate on each element of the matrix
individually, use TIMES (.*) for elementwise multiplication.

Error in project_4 (line 11)
projTrainData = trainData' * EigVec;
The dataset contains the following :
>> whos('-file', 'Face.mat')
  Name           Size               Bytes  Class     Attributes

  II        100820x72            58072320  double              
  m              1x72                 576  double  . Afte running the code, The variables are defined as follows and this information will help you find the root cause of the problem. As far as I know, the testData and trainData sizes are mismatched. So, dig deeper , find the root cause and fix the code. Variable	Size	Type
EigVal	48x48	double
EigVec	48x48	double
II	100820x72	double
m	1x72	double
testData	100820x24	double
testLabels	576x1	double
trainData	100820x48	double
trainLabels	2304x1	double
Here is the code: % Load the dataset
load('Face.mat');

% Divide the dataset into training and testing
[trainData, testData, trainLabels, testLabels] = splitData(II, m);

% Calculate PCA on the training dataset
[EigVec, EigVal] = eig(cov(trainData));

% Project the images onto the Eigenfaces
projTrainData = trainData' * EigVec;
projTestData = testData' * EigVec;

% Select top 6 features using sequentialfs
selection = sequentialfs(@classifierEvalFunc, projTrainData, trainLabels);

% Train the linear classifier using the selected features
classifier = fitcdiscr(projTrainData(:, selection), trainLabels);

% Test the classifier on the testing data
predictions = predict(classifier, projTestData(:, selection));

% Function to split the data into training and testing
function [trainData, testData, trainLabels, testLabels] = splitData(data, labels)
    test_col_indices = 3:3:size(data, 2);
    train_col_indices = 1:size(data, 2);
    train_col_indices(test_col_indices) = [];
    
    testData = data(:, test_col_indices);
    testLabels = labels(:, test_col_indices);
    
    trainData = data(:, train_col_indices);
    trainLabels = labels(:, train_col_indices);
    
    trainData = trainData(:);
    trainData = reshape(trainData, [size(data, 1), numel(train_col_indices)]);
    
    testData = testData(:);
    testData = reshape(testData, [size(data, 1), numel(test_col_indices)]);
    
    testLabels = repmat(testLabels(:), [numel(testLabels), 1]);
    
    trainLabels = repmat(trainLabels(:), [numel(trainLabels), 1]);
end

% Function to evaluate the classifier for sequentialfs
function mse = classifierEvalFunc(X, y)
    classifier = fitcdiscr(X, y);
    y_pred = predict(classifier, X);
    mse = mean((y_pred - y).^2);    
end