How can i pass a matlab struct variable into a C MEX S function as an input argument?

4 vues (au cours des 30 derniers jours)
Xiangjun
Xiangjun le 5 Juil 2023
Commenté : Aditya Singh le 5 Juil 2023
as titled, if it is possible? many thanks.

Réponses (1)

Aditya Singh
Aditya Singh le 5 Juil 2023
Modifié(e) : Aditya Singh le 5 Juil 2023
Hi,
To my understanding you need to pass MATLAB struct to MEX function.
You can do it by calling the C function with a MATLAB StructArray.
st.Name = 'Color';
st.Value = uint8([1 0 1]);
result = myMexFcn(st);
Assign input of MATLAB type struct in the MEX function.
matlab::data::StructArray inStructArray = inputs[0];
and return output to be of type struct in MATLAB.
For more information you can refer to:
Hope it helps
  2 commentaires
Xiangjun
Xiangjun le 5 Juil 2023
Thanks Aditya,
My question is about C MEX S function in simulink module, not C MEX function. I don't think they are same. am i right?
Thanks anyway.
Regards,
Xiangjun

Connectez-vous pour commenter.

Catégories

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

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by