MATLAB Answers

Save GUI after pressing pushbutton

Asked by Hello kity on 14 Jan 2013

I made a GUI with three edit boxes, a value is entered in it, afterwards it should be saved after pressing a push button.

% --- Executes on button press in Table.
function Table_Callback(hObject, eventdata, handles)
% hObject    handle to Tolerantietabel (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
Table=[ str2double(get(handles.T1Long,'String')), str2double(get(handles.T1Lat,'String')), str2double(get(handles.T1Vert,'String')];

Initially, the edit boxes have a value, which i choose (default value). but the user should be able to change that and press asave. after opening again it should show the new values.

How can is save the new entered values?



No products are associated with this question.

1 Answer

Answer by Azzi Abdelmalek
on 14 Jan 2013

You can use a mat file named for example 'initfile', which will be used to default setting in your opening function. Then when the user changes some of these values, update your matfile


Hello kity on 15 Jan 2013

I tried this,

save Table 

in the callback, this made a matrix in the directory.

in the opening function

load Table

so that i can

   set(handles.edit1,'String', double2str(Table(1,1))) etc..

but this gives error...

Ilham Hardy
on 15 Jan 2013

What exactly is the error? post the error mesage as well..

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!