Remove elements in cell array based on index of elements
Show older comments
Hello, I would like to remove elements in a cell array based on index number from another cell array.
For example:
A = [1, 15, 25, 30] B = [1, 4]
A is the data cell array, B is the cell array with indices of elements I want to remove
Output:
A = [15, 25]
for ki = 1:length(difcell)
condition1 = cellfun(@(x)(x<0),difcell,'UniformOutput',false);
gk = cellfun(@(x) find(x==1),condition1,'UniformOutput', false);
% I'm stuck at this stage
% smcell = cellfun(@(x) x(gk), smcell, 'Uniform', 0);
end
Many thanks in advance.
1 Comment
Jonathan Cheong
on 17 Mar 2021
Accepted Answer
More Answers (1)
Jonathan Cheong
on 17 Mar 2021
Categories
Find more on Matrix Indexing 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!