How to remove values less than a set min within a cell array

7 vues (au cours des 30 derniers jours)
Richard Rees
Richard Rees le 19 Déc 2019
Commenté : dpb le 20 Déc 2019
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 commentaires
Richard Reees
Richard Reees le 20 Déc 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.
dpb
dpb le 20 Déc 2019
Well, there are much simpler ways to go at it...

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Structures dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by