Send a newline from the arduino after each sample (or group of samples)
Alternately, send in binary from the arduino and set up a BytesAvailableFcn with BytesAvailableFcnCount that reflects the number of bytes of samples you want to process for each interrupt, and set the serial BytesAvailableFcnMode to 'byte'; you would use fread() to read the bytes and (if appropriate) sscanf() or str2double() to convert them to numeric.
Alternately, send each sample as a fixed number of characters, and set up a BytesAvailableFcn with BytesAvailableFcnCount that reflects the number of bytes of samples you want to process for each interrupt, and set the serial BytesAvailableFcnMode to 'byte'; you would use fread() to read the bytes and (if appropriate) sscanf() or str2double() to convert them to numeric.
What you are likely doing now is just sending each sample without termination, and possibly without any delimiter between samples either. fscanf() does not terminate until the buffer fills up or it sees a terminator or until it times out.
Best Answer