Variable / which matlab does not forget ?
Ältere Kommentare anzeigen
Hey Guys,
function testbutton_Callback(hObject, eventdata, handles)
x = get(handles.edit1,'String')
if ~exist('x','var')
x = []
end
y = [y,x]
This code is supposed to read the edit box and create an array which contains the Data. The array is supposed to expand every time u click the button. However, if the procedure is finished, matlab forgets/kills the x-value. now i want to know, how can i make matlab remember the X-Value after the procedure is done?
Akzeptierte Antwort
Weitere Antworten (2)
Azzi Abdelmalek
am 29 Jul. 2014
Nothing is forgotten, you can the value of x at any time
x = get(handles.edit1,'String')
1 Kommentar
Max Müller
am 29 Jul. 2014
Bearbeitet: Max Müller
am 29 Jul. 2014
Julia
am 29 Jul. 2014
Hi,
try this:
Declare an array/variable y in the opening function
handles.y=0;
and update y every time you write a new value in it:
y=[y,x];
guidata(hObject, handles); % updates handles structure
1 Kommentar
Max Müller
am 29 Jul. 2014
Kategorien
Mehr zu Structures finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!