How can i manipulate c code generated from MATLAB Coder?(DLL)

Hello everyone!
I have a matlab project, which consists of a main function and many outsourced subfunctions.I would like to execute this project in c for better performance. I have used the following work instruction:
(I used the Matlab coder, to write c functions using DLL)
The matlab coder then outputs the corresponding functions translated into c. The procedure works, but the most computationally intensive part of the program, a matrix inversion, still takes a lot of time. that's why I want to rewrite the files generated by the coder so that they do the matrix inversion through the "eigen-library".
For whatever reason, the change i make to the inv.c file has no effect on the execution of the created project in visual studio. Even if I add an error that should make the inv.c function not work at all, the matrix inversion is executed normally, as if I had not made any changes at all.
Now my question is how I can manipulate this generated c code so that the change takes effect in the created project.
And if you know another way to execute a matrix inversion more efficient than MATLAB, please let me know too!
Thank you and happy holidays!

回答 (1 件)

David Fink
David Fink 2023 年 12 月 22 日

2 投票

MATLAB Coder can be configured to use BLAS and LAPACK calls in generated code, which can improve the performance of linear algebra operations like matrix inverse:
However, note that solving systems of equations Ax = b via \ (mldivide) can be more accurate and efficient than using inv:

カテゴリ

ヘルプ センター および File ExchangeMATLAB Coder についてさらに検索

製品

リリース

R2023b

質問済み:

Jan
2023 年 12 月 21 日

回答済み:

2023 年 12 月 22 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by