- 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 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 13 Mai 2019
Bearbeitet: MathWorks Support Team
am 29 Feb. 2024
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"?
Akzeptierte Antwort
MathWorks Support Team
am 18 Jan. 2024
Bearbeitet: MathWorks Support Team
am 29 Feb. 2024
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 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!