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

1 回表示 (過去 30 日間)
Richard Rees
Richard Rees 2019 年 12 月 19 日
コメント済み: dpb 2019 年 12 月 20 日
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 件のコメント
Richard Reees
Richard Reees 2019 年 12 月 20 日
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 2019 年 12 月 20 日
Well, there are much simpler ways to go at it...

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeVariables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by