Function handle invoking Java reports syntax error?
Mostrar comentarios más antiguos
Why does
d='.'; mylength = length(java.io.File(d).listFiles(org.apache.commons.io.filefilter.WildcardFileFilter('*.dat')))
work, but a function handle for input "d" fail with a syntax error?
length_func = @(d) length(java.io.File(d).listFiles(org.apache.commons.io.filefilter.WildcardFileFilter('*.dat')))
??? Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.
1 comentario
Ahmed Fasih
el 7 de Mzo. de 2012
Respuestas (1)
Laurens Bakker
el 7 de Mzo. de 2012
0 votos
Hi Ahmed,
anonymous functions are not allowed to store any data, and accessing a field of java.io.File(d) probably implicitly does this.
Cheers,
Laurens
Categorías
Más información sobre Work with Components en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!