everyone have problem programing in guide, so in guide i opened image with file selector in this i use pushbutton1, so now i want so save this image into database using pushbutton2, always got error on : Undefined function or variable 'image_str'.
Error in pildymas>pushbutton2_Callback (line 291) nuotrauka = {[1],'.jpg',image_str,[42],[42]};
add code below:
function pushbutton1_Callback(hObject, eventdata, handles)
[filename, pathname] = uigetfile({'*.jpg','*.bmp'},'File Selector');
image1 = imread(strcat(pathname, filename));
axes(handles.axes1);
I = imshow(image1);
I = I(:)'; % transpose it
I = im2uint8(I); % convert it to uint8
s = dec2hex(I, 2)'; % convert it to hexcode
image_str = s(:)';
handles.image_str=0;
guidata(hObject,handles)
clear I s
% save the updated handles object
guidata(hObject,handles);
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
%Use handles structure to recall the selected file
conn = database('baze', 'root', 'root', 'Vendor', 'MYSQL', 'Server', 'localhost', 'PortNumber', 3306);
setdbprefs('DataReturnFormat','cellarray');
vardas = get(handles.edit1, 'string');
pavarde = get(handles.edit2, 'string');
laipsnis = get(handles.edit3, 'string');
pareigos = get(handles.edit4, 'string');
telefonas = get(handles.edit5, 'string');
marke = get(handles.edit6, 'string');
numeris = get(handles.edit7, 'string');
tarnyba = get(handles.edit8, 'string');
handles.image_str=0;
nuotrauka = {[1],'.jpg',image_str,[42],[42]};
guidata(hObject, handles);
exdata = {vardas,pavarde,laipsnis,pareigos,telefonas,marke,numeris,tarnyba,nuotrauka};
fastinsert(conn, 'info', {'vardas','pavarde','laipsnis','pareigos','telefonas','marke','numeris','tarnyba','nuotrauka'},exdata)
close(conn);
thanks in advise.