some code of my program:
s=serial('COM1');
s.BaudRate=9600;
s.Timeout=.001;
s.InputBufferSize=12;
function tog1_Callback(hObject, eventdata, handles)
% hObject handle to tog1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global s col conn
set(handles.tog1,'string','Reading Started...');
fopen(s);
while(1)
out=fscanf(s);
if ~isempty(out)
db=cellstr(out);
fastinsert(conn,'RFID_FINAL',col,db);
end
if get(handles.tog1,'value')==0
break;
end
end