I am trying to use findpeaks over a matrix, x, column by column. I am using a for loop as below:
Everything is working fine except for returning widths. P, locs and proms all return as cell arrays with all the data for the peaks in each column. However, widths only returns the widths of the peaks for the last column. When I try to edit it by making widths return as a cell array:
I get the error message "Cell contents assignment to a non-cell array object"
Is there a way to get this function to return all the widths of all the peaks for each column?