Effacer les filtres
Effacer les filtres

arrayfun error

3 vues (au cours des 30 derniers jours)
Mary Kodogianni
Mary Kodogianni le 2 Avr 2011
Hello to everyone,
I have an array of structs g1 = repmat(struct('x0', 0),3,1); g1(1).x0=[1 2 3 69 4 5 ] g1(2).x0=[1 2 3 6 4 5 ] g1(3).x0=[1 32 4 6 4 5 ] and t1= repmat(struct('x0', 0),1,1); t1.x0=69
I m writing the following d= arrayfun(@(t1)isequal(t1.x0),g1) and i get ??? Error using ==> isequal Not enough input arguments.
Error in ==> @(t1)isequal(t1.x0)
Plz help me i've stuck with it...

Réponse acceptée

Matt Fig
Matt Fig le 2 Avr 2011
Please go back and reformat your question. Use the button that looks like this:
{} Code
on the code you pasted in the window.
Now, this is not an ARRAYFUN error but an ISEQUAL error. ISEQUAL takes two arguments.
isequal(9,8)
isequal(pi,pi)
What are you trying to compare? Do you mean this:
d= arrayfun(@(x) eq(x.x0,t1.x0),g1,'Un',0)

Plus de réponses (0)

Catégories

En savoir plus sur Structures dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by