Specified Amount of data was not returned

2 views (last 30 days)
Hi I am trying to read a live video feed from a serial port. It seems no matter what I do, even if I change the Timeout or InputBufferSize or BaudRate, the above error will show up. I am trying to acces a test pattern that was placed on some software through a serial port and then acquired through a camerlink frame grabber. The program I have works for other Com channels perfectly, and I've managed to make this program work once with the serial port, but it won't do it again. I'm wondering what's wrong, why is this error a[pearing? How do I get the video feed and save it?
Whenever I try to use getdata it also shows an error. I'm not sure what I'm supossed to do from here.
Here's the code I'm using to access the serial port and the test patterns:
Pattern = serial('com3', 'BaudRate', 9600, 'Terminator', 'CR/LF', 'Timeout', .50);
Pattern.InputBufferSize = 768;
fopen(Pattern);
fprintf(Pattern,'tp 2');fprintf(Pattern,'go 1000'); char(fread(Pattern,100))
data = fread(Pattern,10,'uint8');

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!