필터 지우기
필터 지우기

How to get data from database in GUI?

조회 수: 2 (최근 30일)
Gytis Raudonius
Gytis Raudonius 2016년 8월 31일
댓글: Gytis Raudonius 2016년 9월 11일
Hey, have problem, i work with license plate recognition. At this moument i have create and link database with matlab, but question is how i can get data about driver from database, by license plate numbers, as you can see in file which add. I want to get data in edittext fields, so if someone can help me with simple example. Thanks for yours answers.
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2016년 9월 1일
Gytis - rather than attaching a zip file, which many of may be reluctant to open, please attach the m and fig files instead.

댓글을 달려면 로그인하십시오.

답변 (2개)

mbonus
mbonus 2016년 9월 1일
You can do
get(findobj('tag','objTagName'),'String')
or
get(hObject,'String')
where objTagName is the tag you assigned to the uicontrol('Style','edit',...) and hObject is the handle if it was saved.
  댓글 수: 3
mbonus
mbonus 2016년 9월 7일
setappdata(0,'VarName',VarName)
getappdata(0,'VarName')
Just make sure that you save it to the root directory (0), that way it can be accessed regardless of whether the GUI has been closed
Gytis Raudonius
Gytis Raudonius 2016년 9월 11일
maybe you can explain more how it should be work
function pushbutton1_Callback(hObject, eventdata, handles)
conn = database('baze', 'root', 'root', 'Vendor', 'MYSQL', 'Server', 'localhost', 'PortNumber', 3306);
a = get(handles.edit8,'String');
%b = get(handles.edit9,'String');
if iscell(a) && numel(a) == 1
a = a{1};
end
if ~ischar(a) || isempty(a);
error('A valid string must be supplied!');
end
sqlquery = ['select vardas, pavarde, laipsnis, pareigos, telefonas, marke, numeris, tarnyba from info '...
'where numeris = ' '''' a ''''];
curs = exec(conn, sqlquery);
curs = fetch(curs);
getappdata(handles.edit9,'vardas');
curs.data
close(curs)
close(conn)

댓글을 달려면 로그인하십시오.


Gytis Raudonius
Gytis Raudonius 2016년 9월 3일
sorry for my ignorance, i made new gui for best understanding how to need it works, so add files below

카테고리

Help CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by