Borrar filtros
Borrar filtros

How to use function structfind properly?

1 visualización (últimos 30 días)
John
John el 14 de Mzo. de 2015
Comentada: Geoff Hayes el 14 de Mzo. de 2015
Hello:
When I test structfind ( http://www.mathworks.com/matlabcentral/fileexchange/29808-structfind ), it's working fine. See:
% test run
structfind(object,'pixels',[6 6])
ans =
1
structfind(object,'pixels',[sy sx])
ans =
1
However, inside my code, the function is returning errors. I'm not sure why. See:
% inside the code
sym1 = sy-1; sxm1 = sx-1;
seedIntensity = originalx(sy,sx);
d1 = abs(seedIntensity - originalx(sym1,sxm1));
inObject = structfind(object(w),'pixels',[sym1,sxm1]);
if (d1 < avgInt && isempty(inObject) == 1)
object(w).pixels = [object(w).pixels; sym1 sxm1];
end
Error using == Matrix dimensions must agree.
Error in cmp (line 31) check=all(x==value);
Error in structfind>@(x)(cmp(x,field,value)) (line 88) index=find(arrayfun(@(x)(cmp(x,field,value)),a,'uniformoutput',true));
Error in structfind (line 88) index=find(arrayfun(@(x)(cmp(x,field,value)),a,'uniformoutput',true))
Where originalx is a 2-D array. Can someone help me troubleshoot?
  1 comentario
Geoff Hayes
Geoff Hayes el 14 de Mzo. de 2015
John - put a breakpoint at the line
inObject = structfind(object(w),'pixels',[sym1,sxm1]);
and run your code. When the debugger pauses at the above line, look at each input. What is object(w), what is sym1, what is sxm1?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Structures 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