Function handle invoking Java reports syntax error?
이전 댓글 표시
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개)
Laurens Bakker
2012년 3월 7일
0 개 추천
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
카테고리
도움말 센터 및 File Exchange에서 Work with Components에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!