How to save output from the for loop in a matrixs?
Show older comments
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 :

Thank you in advance
2 Comments
DGM
on 24 Mar 2021
In this context, what is x in relation to your mxn matrix? What code precedes this?
Kabit Kishore
on 24 Mar 2021
Accepted Answer
More Answers (1)
KALYAN ACHARJYA
on 24 Mar 2021
pks_data=cell(1,length(x));
locs_data=cell(1,length(x));
for i=1:x
[pks,locs]=findpeaks((i),'MinPeakHeight',Thresold);
pks_data{i}=pks;
locs_data{i}=locs;
end
1 Comment
Kabit Kishore
on 24 Mar 2021
Edited: Kabit Kishore
on 24 Mar 2021
Categories
Find more on Descriptive Statistics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!