passing an array of structures to a function
7 次查看(过去 30 天)
显示 更早的评论
Dear Matlab-users, I wrote a function that expects a 2D array of structures as one of its inputs, and treats this variable as such in the function body:
function bma=dcm_bma(model_posteriors,models,nSamp)
But when I try to call the function by passing such a data structure to it, I get the error message:
models =
21x8 struct array with fields:
dcm_bma(posteriors,models,1000);
??? Undefined function or method 'dcm_bma' for input arguments of type 'struct'.
How could I specify that that's exactly what I try to define it for?
Thanks for your help, Mihály
2 个评论
Patrick Kalita
2011-4-8
When you get this error, are you sure that dcm_bma is on your path? What happens if you execute:
>> which dcm_bma
回答(1 个)
Taylor
2025-7-17
dcm_bma probably is not on your path
https://www.mathworks.com/help/matlab/ref/addpath.html
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!