My intention is to show for the output of Matlab System a string the type char_T data[ ], that I receive a function in C through coder.ceval
I want to show more specifically the buffer variable, as it would have to declare the buffer variable
matlab
function data = stepImpl(obj)
buffer = ¿¿ ??;
if coder.target ('Rtw')
coder.cinclude('File_Wrapper.h');
coder.ceval('function',obj.port, coder.wref(buffer));
data = ¿¿¿ string(buffer) ???;
end
end
this would be the function sent to me by char_T data[ ], I use coder.wref to fill the variable in the following method
void function(uint8_T uartPort, char_T data[])
{
char buffer[30];
if (uartPort == 1)
{
fgets(buffer, 10, uart1);
}
else if (uartPort == 2)
{
fgets(buffer, 10, uart2);
}
snprintf (data, sizeof(buffer), "%s", buffer);
}
This post dont work for me: Converting a C char array into a Matlab String using Matlab Coder