Arduino Mega 2560 USB to Serial blocks when fopen from matlab its use


my problem its very simple, i narrowed it down to a single issue, whenever i try to open serial communication from matlab with fopen, arduino mega blocks for a few seconds. Led on pin 13 lights up for those few seconds, after that i can send and receive information, i tried the same program on arduino UNO and it works so is not the code, i ran out of options i tried almost everything , the only thing left to try is to use the other serials on mi arduino even though i need them for something else. o and it even does what i described earlier with nothing on the arduino

Code on arduino

void setup ()

void loop()

Code on matlab

s = serial('COM4');

i know the code works cause when the led on pin 13 turns off i can send data and receive, so my question is why if there is nothing on the arduino fopen from matlab has an effect on the arduino. o and i know about the auto reste issue but is not autoreseting. O and these seconds, around 5 way too long, are crucial for my applicaton.

best regards

i found this;wap2

the same behavior, did they found a solution?