arrayfun error

2 次查看(过去 30 天)
Mary Kodogianni
Mary Kodogianni 2011-4-2
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...

采纳的回答

Matt Fig
Matt Fig 2011-4-2
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)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by