serial communication matlab & mega

Hi all,

This is a more Matlab orientated question, but maybe someone has had the same problem can help me.

I want to use a Mega as data acquisition for a matlab script.
The data transfer is working, but to slow for my purpose. I want to achieve 100 Hz, preferably more.

I’ve narrowed the ‘problem’ down to a piece of matlab code that appears to take up most of the time.

s = serial(‘COM9’);
s.BaudRate=250000;
fopen(s)

for i = 1 : 100
tic
fwrite(s,5);
time1(i)=toc;
end
mean(time1)

ans =

0.0106

The baud rate is set at 250000, still only writing limits the script to < 94 Hz.
also tried fpirintf, with the same result.

Does anyone know a way to increase the data speed to the arduino?

Thanks,

Does anyone know a way to increase the data speed to the arduino?

The data speed is probably not the issue.