Random trash received from serial port


I am trying to send some data from the Arduino trough the serial port but, for no reason, every time the port ‘COM3’ is being opened and I ask for data (on Matlab or the serial monitor), I get the first or the first two bytes as trash (sometimes, even none). How do I know precisely it is one or two you may ask ? I use Matlab to receive the data in the form of bytes and it displays correctly the number the Arduino is supposed to send after one or two bytes. I also can show you the serial monitor although it is less evident. Here is the code (don’t be amazed by the complexity of it) :

byte test1 = 66;

void setup()
  Serial.begin (9600);
  while (! Serial);

void loop() {

I searched on the arduino forum and I found this thread : https://forum.arduino.cc/index.php?topic=414439.0 in which there is this stackoverflow thread : ESP8266 gives garbage using Arduino IDE - Stack Overflow

To resume, the problem could come from the initialization of the baud rate (when I write “Serial.begin (9600);” because the default baud rate of the Arduino firmware isn’t 9600 OR also from the power supply that is to weak. I’m using currently the USB power supply, do you think I should switch with a 12V power supply ? Do you have any other explanations ? Do you have any other test or idea about what I should do ? I can’t even try to delete the first two trashy bytes by receiving them because it is random; sometimes it’s one trashy byte, sometimes even none. Or maybe I can put to trash the first two bytes and not caring about loss of data since the current application I’m using it for doesn’t require high precision at all time but in case I need to, I’m asking you if you can help me.

Also, you can see in the serial monitor I joined that there is a weird amount of space before all the B’s (which is the ASCII letter for 66). No idea where it comes from.

PS : Also I just did the tests with a 9V power Supply and it still sends trash data.

Sincerely yours

If you precede that data sent from the Arduino with a start of data indicator, perhaps '*' or any other character that will never appear in the data, then you can ignore any characters received before the start marker