Here’s some MATLAB code that will read data from a Freestyle blood glucose meter that is attached to your computer via serial cable.
(Be sure to replace the “smart” quotes with appropriate single quotes. And the “…”, too. Sorry.)
% Jeff Mather - 3 October 2001 % Connect to meter. s = serial('com1', 'baudrate', 19200, ... 'FlowControl', 'Software'); fopen(s); % Initiate communication. fprintf(s, 'mem'); fprintf(s, 'log250'); % Read diagnostics. fgetl(s); % First line is empty. meter_ID = fgetl(s); software_ver = fgetl(s); current_time = fgetl(s); num_readings = str2num(fgetl(s)); for p = 1:num_readings reading = fgetl(s); sprintf(reading) pause(0.25); end fclose(s);