MATLAB: How to design Swap logic with Simulink blocks to get the same code with Embedded coder

c code conversiondyanamic arrayEmbedded Codersimulinkswapswapping

can any one tell me how to design below swap logic with simulink blocks, to get same code with embedded coder.
void Swap(int *p,int *q)
{
temp = *p;
*p = *q;
*q = temp;
}
is there any possibulity to get the code same like above with embedded coder?

Best Answer

  • You can always use MATLAB function block to design the swap logic.You only need to write the swap logic in the function block. For more information on this you can use the following documentation: