Here are some points to consider:
- Variable Scope: featim is being overwritten in each iteration of the loop. If you want to create a histogram of featim after the loop, you should accumulate the data across iterations.
- Data Dimensionality: hist3 is used for 2D histograms. If featim is a 1D array, you should use histogram instead (https://www.mathworks.com/help/matlab/ref/matlab.graphics.chart.primitive.histogram.html) .
- Data Storage: Ensure that gmlog(A) returns data in a format suitable for a histogram (e.g., a 1D array).
feat = zeros(982, 40); % Assuming 40 is the length of feature vector
allFeatim = []; % To accumulate all featim data
for k = 1:982
A = FYPdatabase{k, 1};
featim = gmlog(A);
FYPdatabase{k, 5} = featim;
% Assuming featim is a vector, accumulate it
allFeatim = [allFeatim; featim(:)]; % Concatenate featim into a single column
end
% Create a histogram for all accumulated featim data
histogram(allFeatim);
xlabel('Feature Value');
ylabel('Frequency');
title('Histogram of Feature Values');
allFeatim = [allFeatim; featim(:)] ensures that all feature values are stored in a single column vector, suitable for histogram plotting. Adjust the code further based on the specific output format of gmlog(A).