multiple variables into a cellfun

6 visualizaciones (últimos 30 días)
N/A
N/A el 28 de Sept. de 2019
Respondida: Rik el 29 de Sept. de 2019
for j = 1:size(A,1)
i = cellfun(@(x) isequal(x, [A{j}]), C);
end
Objective: get rid of the loop
I have the following problem:
A is an cell array witch consist of cells that are 1xn double , where n is element of Natural numbers
Similair for C, but C has less cells. Goal is to check for every cell in A if it is equal to any cell in C.
my objective is to get rid of the for loop.
I tried this but i get a dimesion error
i = cellfun(@(x,d) isequal(x, [A{j}]), C, num2cell([1:size(A,1)]));

Respuestas (1)

Rik
Rik el 29 de Sept. de 2019
This sounds like a perfect situation for the ismember function.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by