How to remove values less than a set min within a cell array
조회 수: 2 (최근 30일)
이전 댓글 표시
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
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.
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!