Академический Документы
Профессиональный Документы
Культура Документы
BEST OF LUCK.
Engr Rana Muhammad Shakeel
Engnr.shakeel@gmail.com
+92-333-4962507
https://www.facebook.com/EngnrShakeel
Serial Communication,
GUI Diagram
Serial Communication,
Code:
function varargout = UserGUI(varargin)
% USERGUI M-file for UserGUI.fig
%
USERGUI, by itself, creates a new USERGUI or raises the existing
%
singleton*.
%
%
H = USERGUI returns the handle to a new USERGUI or the handle to
%
the existing singleton*.
%
%
USERGUI('CALLBACK',hObject,eventData,handles,...) calls the local
%
function named CALLBACK in USERGUI.M with the given input arguments.
Serial Communication,
%
%
USERGUI('Property','Value',...) creates a new USERGUI or raises the
%
existing singleton*. Starting from the left, property value pairs are
%
applied to the GUI before UserGUI_OpeningFcn gets called. An
%
unrecognized property name or invalid value makes property application
%
stop. All inputs are passed to UserGUI_OpeningFcn via varargin.
%
%
*See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
%
instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help UserGUI
% Last Modified by GUIDE v2.5 30-Nov-2013 18:44:25
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',
mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @UserGUI_OpeningFcn, ...
'gui_OutputFcn', @UserGUI_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback',
[]);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Outputs from this function are returned to the command line.
Serial Communication,
');
Serial Communication,
set(handles.Name_edit2,'string',Name);
Vehical=VEHICAL(x);
%display VEHICAL no of
set(handles.Vehical_edit3,'string',Vehical);
Engine=ENGINE(x);
%display engine no of
set(handles.Engine_edit4,'string',Engine);
Chasis=CHASIS(x);
%display chasis no of
set(handles.Chasis_edit5,'string',Chasis);
int32 y;
Mobile=MOBILE(x);
%display mobile of the "x" RFID
y=cell2mat(Mobile);
%convert cell to data numaeric
m=mat2str(y);
%convert datae numaeric to string
set(handles.Mobile_edit6,'string',m);
Balance=BALANCE(x);
%display balance of the "x" RFID
y=cell2mat(Balance);
%convert cell to data numaeric
m=mat2str(y) ;
%convert datae numaeric to string
set(handles.Balance_edit7,'string',m);
Toll1=TOLL1(x);
%display TOLL1 of the "x" RFID
y=cell2mat(Toll1);
%convert cell to data numaeric
m=mat2str(y) ;
%convert datae numaeric to string
set(handles.Toll1_edit8,'string',m);
Toll2=TOLL2(x);
%display TOLL2 of the "x" RFID
y=cell2mat(Toll2);
%convert cell to data numaeric
m=mat2str(y);
%convert datae numaeric to string
set(handles.Toll2_edit9,'string',m);
end
ans=0;
a = (get(handles.RFID_edit1,'string'));
id=str2num(a); %converting strinf to number
for i=1:no;
Serial Communication,
to cell
name = (get(handles.Name_edit2,'string'));
NAMES(no)=cellstr(name); %convert str data in to aarray
alldata(:,2)=NAMES(); %adding updated aarraay
veh = (get(handles.Vehical_edit3,'string'));
VEHICAL(no)=cellstr(veh); %convert str data in to aarray
alldata(:,3)=VEHICAL(); %adding updated aarraay
eng =(get(handles.Engine_edit4,'string'));
ENGINE(no)=cellstr(eng); %convert str data in to aarray
alldata(:,4)=ENGINE(); %adding updated aarraay
chas = (get(handles.Chasis_edit5,'string'));
CHASIS(no)=cellstr(chas); %convert str data in to aarray
alldata(:,5)=CHASIS(); %adding updated aarraay
mob = (get(handles.Mobile_edit6,'string'));
MOBILE(no)=mat2cell(mob); %convert numeric data
alldata(:,6)=MOBILE(); %adding updated aarraay
to cell
blc = (get(handles.Balance_edit7,'string'));
BALANCE(no)=mat2cell(blc); %convert numeric data
alldata(:,7)=BALANCE(); %adding updated aarraay
t1 = (get(handles.Toll1_edit8,'string'));
TOLL1(no)=mat2cell(t1); %convert numeric data
alldata(:,8)=TOLL1(); %adding updated aarraay
to cell
to cell
t2 = (get(handles.Toll2_edit9,'string'));
TOLL2(no)=mat2cell(t2); %convert numeric data to cell
alldata(:,9)=TOLL2(); %adding updated aarraay
xlswrite('test.xlsx',alldata) %updating the MS EXCEL file
set(handles.error_flag,'string','Database Updated'); %NEW RFID is STORED
in Database
end
Serial Communication,
Serial Communication,
Engine=(get(handles.Engine_edit4,'string'));
% Hints: get(hObject,'String') returns contents of Engine_edit4 as text
%
str2double(get(hObject,'String')) returns contents of Engine_edit4 as
a double
Serial Communication,
10
Serial Communication,
% handles
11
Serial Communication,
12
Serial Communication,
a = (get(handles.RFID_edit1,'string'));
id=str2num(a); %converting strinf to number
RFID(no)=mat2cell(id); %convert numeric data
alldata(:,1)=RFID(); %adding updated aarraay
to cell
name = (get(handles.Name_edit2,'string'));
NAMES(no)=cellstr(name); %convert str data in to aarray
alldata(:,2)=NAMES(); %adding updated aarraay
veh = (get(handles.Vehical_edit3,'string'));
VEHICAL(no)=cellstr(veh); %convert str data in to aarray
alldata(:,3)=VEHICAL(); %adding updated aarraay
eng =(get(handles.Engine_edit4,'string'));
ENGINE(no)=cellstr(eng); %convert str data in to aarray
alldata(:,4)=ENGINE(); %adding updated aarraay
chas = (get(handles.Chasis_edit5,'string'));
CHASIS(no)=cellstr(chas); %convert str data in to aarray
alldata(:,5)=CHASIS(); %adding updated aarraay
mob = (get(handles.Mobile_edit6,'string'));
MOBILE(no)=mat2cell(mob); %convert numeric data
alldata(:,6)=MOBILE(); %adding updated aarraay
to cell
blc = (get(handles.Balance_edit7,'string'));
BALANCE(no)=mat2cell(blc); %convert numeric data
alldata(:,7)=BALANCE(); %adding updated aarraay
t1 = (get(handles.Toll1_edit8,'string'));
TOLL1(no)=mat2cell(t1); %convert numeric data
alldata(:,8)=TOLL1(); %adding updated aarraay
to cell
to cell
t2 = (get(handles.Toll2_edit9,'string'));
TOLL2(no)=mat2cell(t2); %convert numeric data to cell
alldata(:,9)=TOLL2(); %adding updated aarraay
xlswrite('test.xlsx',alldata) %updating the MS EXCEL file
set(handles.error_flag,'string','Database Updated'); %NEW RFID is STORED
in Databas
13
Serial Communication,
FUNCTION1: Dataa()
function [RFID,NAMES,VEHICAL,ENGINE,CHASIS,MOBILE,BALANCE,TOLL1,TOLL2]=Dataa()
14