Clear Filters
Clear Filters

arrayfun error

3 views (last 30 days)
Mary Kodogianni
Mary Kodogianni on 2 Apr 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...

Accepted Answer

Matt Fig
Matt Fig on 2 Apr 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)

More Answers (0)

Categories

Find more on Structures 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!