我正在查看这段 MATLAB 代码,它有一些示例。我正在执行 test_bnpc_asia.m,但遇到了错误。如何更正它?(我有 MATLAB R2010B)
执行:
>> test_bnpc_asia.m================== phase I : Execution time : 0.12480================== phase II : Execution time : 0.01560================== phase III : Thinning - separateAThinning - separateBThinning - orient_edgesInfering directions 0 bouclesExecution time : 0.10920score_Phase_3 = -6.0994e+003Report genered in :ans =C:\Program Files\MATLAB\R2010b\BNT_SLP\examplesWarning: Direct access of structure fields returned by a function call (e.g., call to test_bnpc_asia) is not allowed. See MATLAB 7.10 Release Notes, "Subscripting Into Function Return Values" for details. ??? Attempt to reference field of non-structure array.
回答:
你应该直接输入
test_bnpc_asia
而不是
test_bnpc_asia.m
文件扩展名会自动添加。 如果你添加它,MATLAB 会认为函数 test_bnpc_asia 返回一个结构,并且你想访问该结构中包含的字段“m”。