fminsearch in Matlab classes for code generation
조회 수: 8 (최근 30일)
이전 댓글 표시
I am designing a Matlab class to do some optimization and I am using fminsearch. I want to put it into a user-defined Matlab function in Simulink. I know the anonymous functions have issues with code generation so I constructed the objective function as a class method so I can avoid using the anonymous function. Then, I ended up with something like fminsearch(@obj.objFunc,x,options). Everything works fine in a little unit test I wrote in Matlab script. However, after I put it into the user-defined Matlab function in Simulink, it complains that "code generation does not support function handles pointing to non-static methods." I cannot change the attribute of my objective function into "static", since it requires the information of other variables of the class properties. So how I can use fminsearch in a Matlab class with code generation? Thanks.
댓글 수: 0
답변 (1개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!