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

1 vue (au cours des 30 derniers jours)
Jan
Jan le 21 Déc 2023
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!

Réponses (1)

David Fink
David Fink le 22 Déc 2023
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:

Catégories

En savoir plus sur MATLAB Coder dans Help Center et File Exchange

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by