@struct method not being found

1 回表示 (過去 30 日間)
Brandon Kuczenski
Brandon Kuczenski 2014 年 3 月 21 日
回答済み: Brandon Kuczenski 2014 年 4 月 2 日
I have written a number of extensions to the Matlab struct type, which I have stored in a directory called @struct. One of these methods is declared as follows:
function D=moddata(D,Field,Fn,new)
...
in which Fn is a function handle.
However, I am seeing the following behavior:
K>> which moddata
C:\Users\...\util\@struct\moddata.m % struct method
K>> isa(S,'struct')
ans =
1
K>> moddata(S,'Path',@(x)regexprep(x,my_RE,'$1'),'CIPath')
Error using keyboard
Undefined function 'moddata' for input arguments of type 'function_handle'.
K>>
Other methods in the @struct folder are being accessed just fine.
Why is Matlab not finding my method? It seems to be unduly focusing on the function_handle instead of the struct argument.
Thanks in advance.

採用された回答

Brandon Kuczenski
Brandon Kuczenski 2014 年 4 月 2 日
I have been advised by Matlab support that this is expected behavior, because function_handle has higher precedence than struct- even though struct is the first argument- a function_handle method is sought.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by