- Trace through the code to see where the size of mystruct.field goes wrong. That may give a clue.
- If Coder can't figure out that the output of mysubfunction is 1x1 you can give it a clue
How to define the size of output in subfunctions, for C coder
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello everybody,
I am experiencing an issue when porting a function to C with Matlab coder.
I have a function which runs inside a parfor parallel loop like
output = myfunction(id, mystruct) ;
where id is the parfor index and mystruct an input structure with one dimensional fields which are 1xn arrays, where n is variable.
inside myfunction there is a subfunction which is called inside myfunction like
output_temp = mysubfunction(mystruct.field)
where output_temp is a 1x1 variable.
Everything works in Matlab.
When I build code to port the function in C with Matlab coder, I get the following issue.
I define the input mystruct.field as unbound :1x:Inf, but at the "check for issues" stage, in the mysubfunction the coder sees mystruct.field as :Infx:Inf so that the coder sees output_temp as :1x:Inf instead of 1x1, and this generates an error. I am run out of ideas and cannot fix this...
Can you help me in fixing this, please?
Thanks in advance,
Patrizio
Réponses (0)
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!