- Please run the below command in the MATLAB R2018b command window to get the release specific documentationweb(fullfile(docroot, 'ecoder/ug/code-you-can-replace-from-simulink-models.html'))
- Please run the below command in the MATLAB R2018b command window to get the release specific documentationweb(fullfile(docroot, 'ecoder/ug/code-you-can-replace-from-matlab-code.html'))
Why is the code replacement triggered for the Matrix Inverse block but not the inv() function in a MATLAB function block?
1 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2019-5-13
编辑: MathWorks Support Team
2024-2-29
I am generating code for a model with a MATLAB Function block. In the MATLAB Function block, I call the inv() function.
I expect the code generated for the inv() function by embedded coder to be replaced by the function "matrix_inv_2x2_double" (a function specified in the rtwdemo_crlmatops demo). However this does not happen. On the other hand, the matrix inverse block is indeed replaced by this function.
Is there a way to get the inv() function in the MATLAB Function block replaced by "matrix_inv_2x2_double"?
采纳的回答
MathWorks Support Team
2024-1-18
编辑:MathWorks Support Team
2024-2-29
Unfortunately, "inv" cannot be replaced when used in a MATLAB Function block, since this is a limitation with replacing functions in MATLAB code:
The former contains "inv" as an operator that can be replaced, but the latter does not. Thus, the Code Replacement Library does not support the inv() function. There is a workaround to this however: the "inv" operation was wrapped inside an additional MATLAB Function "myInvWrapper". A code replacement for that was then specified, using the following workflow:
Please run the below command in the MATLAB R2018b command window to get the release specific documentation
web(fullfile(docroot, 'ecoder/ug/replace-matlab-functions-specified-in-matlabfunction-blocks-sc.html'))
Please follow the below link to search for the required information regarding the current release:
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!