How to create array from old array with values greater than a specified value?
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Kimberly Cardillo
am 15 Jun. 2020
Kommentiert: Kimberly Cardillo
am 15 Jun. 2020
I have a cell array called timePks as seen below. Each cell has a column of numbers and I want to create a new cell array with the values from timePks that are greater than 20. I don't want the values that are less than 20 to be in the new cell array.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/316656/image.jpeg)
[timePks{i},timeLocs{i}]=findpeaks(aefm_1(1200:1450,i));
[ss{i},tt{i}] = find(timePks{i}>20);
When I run the code above, ss{i} gives me cell arrays of the row #'s that has a value above 20 but I want it to say the value, not the row number it belongs in.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
the cyclist
am 15 Jun. 2020
% Some made-up data
timePks = {[10; 20; 30; 40],[5; 10; 20; 25],[1; 2; 3]};
% Output with only values greater than 20
output = cellfun(@(x)x(x>20),timePks,'UniformOutput',false)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Data Type Identification 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!