From: Erik on
Hi,

I read information from a device on a serial communication. The data is received as ASCII-signs. For example, the number 1.5 is received as three ASCII-signs (49 46 53). In my simulink model, which I build using Real-Time workshop and download to my control platform (dSpace microautobox), I would like to convert the received ASCII-signs to the format of a double. The Matlab function native2unicode converts the three ASCII signs to the string '1.5'. Then I use the function str2double to get it as double. However, when I create an s-function to be used in my simulink model for this conversion I get an error message when I build my model saying:
"Failed to eliminate a use of the MATLAB function 'str2double'.
For non-simulation builds, uses of unsupported MATLAB functions are eliminated if they do not effect the model outputs."

It seems the 'str2double' function is not allowed to be used in an s-function. Is this true? Is there a way to get around this problem so that I can convert the received ASCII-signs to double in my simulink model (without forcing me to create my own conversion functions)?

Thank you,
Erik