How to remove values less than a set min within a cell array
2 views (last 30 days)
Show older comments
Hi everyone, I have multiple cell arrays, contained within are row vectors. What I want to do is remove any value within these rows that is less than a specified one. I have tried doing it in a loop and using cell function but I cannot quite get it to work.
I know using the loop it is logically detecting that the first element is <22 (min_s), but unlike a normal matrix I cannot remove those values.
The cell function I have tried to use but cannot figure out away around the '<' being rejected
load 'cell_test.mat'
min_s = 22
for i = 5
for j = 1:5%size(av_Nod_sqz_select{1,1},1)
[ppks{i}{j,1},plocs{i}{j,1}] = findpeaks(av_Nod_sqz_select{1,i}(j,:));
if plocs{i}{j,1}(:) < min_s
plocs{i}{j,1} = [];
end
end
end
A = cellfun(@(plocs) plocs(:,plocs<min_s), plocs, 'Uniform',0);% One of many attempts
5 Comments
Richard Reees
on 20 Dec 2019
Hi, it is fine. I got what I need it to do with the code above.
Its a 2D geotechnical simulation that I am doing some analysis on regarding pressure changes, the way the data is saved is a seperate spreadsheet per timestep, so I have to collect all the data from that.
Answers (0)
See Also
Categories
Find more on Variables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!