How to assign multiple inputs from the same edit text box in MATLAB GUI into a cell array variable?
Afficher commentaires plus anciens
Hello. My goal is to create a cell array variable from the inputs of the edit text box. For example,
name={'first input' ; 'second input' ; ...}
Is this possible or should I try a different approach on creating that cell array variable? If it's the latter, can you help explain that? Thank you.
Réponses (1)
Walter Roberson
le 23 Avr 2019
name = {handles.First_editbox.String, handles.Second_editbox.String, ...}
7 commentaires
Natasya Kamarudin
le 24 Avr 2019
Walter Roberson
le 25 Avr 2019
http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
Initialize a variable. Each time the Callback on the edit box gets triggered, retrieve the variable and appened the new entry to the end of it, and save the variable away again.
Natasya Kamarudin
le 10 Mai 2019
Walter Roberson
le 10 Mai 2019
Modifié(e) : Walter Roberson
le 10 Mai 2019
if ~isfield(handles, 'saved_answers')
handles.saved_answers = {};
end
this_answer = get(hObject, 'String');
handles.saved_answers{end+1} = this_answer;
guidata(hObject, handles); %update master copy
Natasya Kamarudin
le 10 Mai 2019
Walter Roberson
le 10 Mai 2019
I had a mistake there; I have fixed the line.
Natasya Kamarudin
le 10 Mai 2019
Catégories
En savoir plus sur Entering Commands dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!