Failing to receive correct data from serial connection in Simulink

I am trying to make a serial connection between Arduino and Simulink through Serial.
However, data received does not match data I send.
Arduino code

void setup() {
 while (!Serial) {
long K;
void loop() 

Pictures of connections

I work on normal mode

There’s no way this much time is passed. And this issue stands on all binary data types.
Thanks for any help…

Attached a ZIP for ones who want to see Simulink model (17.4 KB)

You are only showing us one piece of the puzzle since there is no simulink code or diagrams attached to your post.

We can't help until you post them.

Quick tip, though, be careful about writing too much data to your PC too fast. If simulink isn't fast enough to parse all the data, you might get erratic behavior. Check this out - might help you.

I modified the post and added it as a Zip file

After reading your linkk, I feel like the error may be on start-end bytes or using normal mode instead real-time, but it is still a very big area to look for. Honestly, I am still quite newbie...

Solved it. Topic may shut-down

Apparently Arduino does not send 32 byte data, even if it is defined long.
When converting, Simulink adds fills 0 binary value to the number so it gets bigger.

We should take uint8 values as char, define header and terminator, convert it to string and double.