Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Repeat in try catch function after close function in GUI

1 visualización (últimos 30 días)
Gytis Raudonius
Gytis Raudonius el 30 de Dic. de 2016
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
I have 2 guides. From "Main" guide i called "Search" guide. In search guide have code which check or input value is true if is true got new guide with info. But if input value is false i got popup-message, and still new guide just without info. When i add close function it makes loop and always popup new window and new guide. Please help me. Thanks in advise. Sorry for english.
conn = database('baze', 'root', 'root', 'Vendor', 'MYSQL', 'Server', 'localhost', 'PortNumber', 3306);
setdbprefs('datareturnformat','structure');
a = getappdata(0,'numeris');
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, nuotrauka from info '...
'where numeris = ' '''' a ''''];
curs = exec(conn, sqlquery);
setdbprefs('DataReturnFormat','cellarray');
curs = fetch(curs);
if isempty(curs) || ~isstruct(curs) || ~isfield(curs, 'data') || size(curs.data,2) < 7
try
numeris = curs.data{7};
vardas = curs.data{1};
pavarde = curs.data{2};
laipsnis = curs.data{3};
pareigos = curs.data{4};
telefonas = curs.data{5};
marke = curs.data{6};
tarnyba = curs.data{8};
nuotrauka = curs.data(9);
set(handles.edit1,'string',vardas);
set(handles.edit2,'string',pavarde);
set(handles.edit3,'string',laipsnis);
set(handles.edit4,'string',pareigos);
set(handles.edit5,'string',telefonas);
set(handles.edit6,'string',marke);
set(handles.edit7,'string',numeris);
set(handles.edit8,'string',tarnyba);
axes(handles.axes1);
nuotrauka = nuotrauka{1};
jimage = javax.imageio.ImageIO.read(java.io.ByteArrayInputStream(typecast(nuotrauka, 'uint8')));
height = jimage.getHeight;
width = jimage.getWidth;
pixels = reshape(typecast(jimage.getData.getDataStorage, 'uint8'), [3,width,height]);
img = cat(3, ...
transpose(reshape(pixels(3,:,:), [width,height])), ...
transpose(reshape(pixels(2,:,:), [width,height])), ...
transpose(reshape(pixels(1,:,:), [width,height])));
imshow(img);
catch
h = msgbox('Patikrinkite ar teisingai įvesti automobilio numeriai','Įspėjimas','Warn');
close (paieska)
return
end
end
close(curs);
close(conn);

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by