variables in c is input for a function running in matlab and print in c, how to
Afficher commentaires plus anciens
How can I create a link between c and matlab, I have to take input from c program run a function in matlab and then print the output in c.
13 commentaires
Walter Roberson
le 5 Jan 2022
Modifié(e) : James Tursa
le 5 Jan 2022
Rashi Mehrotra
le 6 Jan 2022
Modifié(e) : KSSV
le 6 Jan 2022
KSSV
le 6 Jan 2022
I think you may have to explore mex.
Rashi Mehrotra
le 6 Jan 2022
Walter Roberson
le 6 Jan 2022
MATLAB Compiler SDK perhaps, if there is a hard need to be able to call the function directly from C without having to write a shim to invoke the MATLAB Engine API.
Rashi Mehrotra
le 6 Jan 2022
Walter Roberson
le 6 Jan 2022
No, I cannot tell you that. I have not used that product myself.
Question: is the intention that you would have a "live" (licensed, full featured) MATLAB session that you are interacting with from C? If so then you need Automation Engine or equivalent interface.
But if the intention is to build everything into an single executable that does not require a MATLAB licence to execute, then you either need MATLAB Compiler SDK or else MATLAB Coder
Rashi Mehrotra
le 13 Jan 2022
Walter Roberson
le 13 Jan 2022
Does this functionality have to be compiled into a single executable that needs to be able to run without a MATLAB license?
Or is it possible that it could run on a machine that had a licensed version of MATLAB installed and that the C program could ask the MATLAB program to do some work on its behalf?
Rashi Mehrotra
le 4 Fév 2022
Walter Roberson
le 4 Fév 2022
Modifié(e) : Walter Roberson
le 4 Fév 2022
Then use https://www.mathworks.com/help/matlab/matlab-api-for-c.html using functions such as engOpen() engPutVariable() engEvalString() engGetVariable()
Rashi Mehrotra
le 10 Fév 2022
Walter Roberson
le 10 Fév 2022
What error message do you observe?
Réponses (1)
Benjamin Thompson
le 10 Fév 2022
0 votes
Use mex to build C code into a function callable in MATLAB. There is a lot of information and examples in the documentation.
Catégories
En savoir plus sur MATLAB Compiler SDK dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!