MATLAB: Arrayfun error

error with arrayfun

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…

Best Answer

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)