Hi i have a matrix with M x n dimension. I have performed the peak analysis for each column in the for loop. I want to save the output for the for loop as a matrix. I have used the following for loop. for i=x [pks,locs]=findpeaks((i),'MinPeakHeight',Thresold) end I get output like this :
Kshitij Singh answered .
2025-11-20
[rows, columns] = size(data) % Size of your 2-D matrix of signals.
allPeakValues = cell(1, columns);
allPeakIndexes = cell(1, columns);
for col = 1 : columns
% Extract one column from the matrix.
thisColumn = data(:, col);
% Find the peaks in that column.
[thesePeakValues, theseIndexesOfPeaks] = findpeaks(thisColumn, 'MinPeakHeight', Threshold);
% Save the peaks for this particular column in our cell array that
% holds results for all the columns.
allPeakValues{col} = thesePeakValues;
allPeakIndexes{col} = theseIndexesOfPeaks;
end