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

조회 수: 2 (최근 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 CenterFile Exchange에서 Variables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by