- 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).
how to create a histogram for featim?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
hi matlab community, is something wrong with my coding below? i want to create a histogram for featim. thnkyou so much.
feat=zeros(982,40);
for k=1:982
A=FYPdatabase{k,1};
featim=gmlog(A);
FYPdatabase{k,5}=featim;
end
hist3(featim);
0 Kommentare
Antworten (1)
Abhinaya Kennedy
am 20 Aug. 2024
Here are some points to consider:
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).
0 Kommentare
Siehe auch
Kategorien
Mehr zu Histograms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!