> I tried to do it but it doesn't work. I don't know why I should use this buffer block. The INput signal is formed by 4 uint8 values that arrive at the same time and are joined in an vector by a mux block, which is then introduced into the data type conversion block.
I had assumed the data was coming in serially.
If it's in parallel then the buffering isn't required, and a simple concatenation/mux will do.
Then just feed the output of the concat/mux into an Embedded MATLAB Function block that contains
%%%%%%%%%%%%cut here%%%%%%%%%%%%%
function y = fcn(u)
eml.extrinsic('typecast');
y = 0;
y = double(typecast(u,'single'));
%%%%%%%%%%%%%cut here%%%%%%%%%%%%%
> As far as I know, S-Functions' performance is slower than Simulink blocks, doesn't it?
yes, but...
If you can do the same thing in either Simulink blocks, an m-code S-Function or a c-mex S-function then the m-code S-function will be the worst performing.
But if you cant' do it using Simulink blocks then you need to use an S-Function.
Without knowing your application, initially I'd suggest just doing the above.
If speed becomes an issue then spent time looking for alternatives.
Phil.