I meet a problem when I'm trying to plotting some signals in real time from Arduino to Matltb. I use 'tic toc' to get elapsed time and it works. But when I look back to the 'time' output, the intervals between two neighouring index are irregular. But I want the time intervals to be fixed, for example, it recordes index every 0.3 seconds regularly. My code is look like below:
a = arduino()
count = count + 1;
time(count) = toc;
I understand why that tic toc can lead to such irregular time intervals, so is there any other options I can use to represent the elapsed time with consistent increasement? Thanks a lot for your help!