Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

How do I get the answers from dynamic edit boxes, in order to do calculations?

1 vue (au cours des 30 derniers jours)
Ahmed Khalil
Ahmed Khalil le 27 Déc 2017
Clôturé : MATLAB Answer Bot le 20 Août 2021
I was making a GUI which will make multiple text boxes depending on the user input. The code gets the number of stages to make from 'handles.edit1' and then makes the number of boxes accordingly
stages = str2num(get(handles.edit1,'String'));
sdesign = zeros(stages,1);
design = zeros(stages,1);
squantity = zeros(stages,1);
quantity = zeros(stages,1);
srate = zeros(stages,1);
rate = zeros(stages,1);
panel = uipanel('parent',multidesign,...
'Title','Enter Design Rates and Quantity',...
'position',[.01 -.1 0.98 .95]);
for i = 1:stages
sdesign(i,1) = uicontrol('parent',panel,'style','text',...
'string','Design Number:',...
'position',[0 370-i*30 100 20]);
design = uicontrol('parent',panel,'Style','edit',...
'String','',...
'Position',[90 372-i*30 40 20])';
squantity = uicontrol('parent',panel,'Style','text',...
'String','Quantity:',...
'Position',[150 372-i*30 50 20])';
quantity = uicontrol('parent',panel,'Style','edit',...
'String','',...
'Position',[200 374-i*30 40 20])';
srate = uicontrol('parent',panel,'Style','text',...
'String','Rate:',...
'Position',[260 372-i*30 50 20])';
rate = uicontrol('parent',panel,'Style','edit',...
'String','',...
'Position',[300 374-i*30 40 20])';
end
I wanted to know how do I get the data from the multiple boxes since they are dynamic. I just know we have to assign each of them individual tags from which they can be called back. Thanks a lot for your help!

Réponses (1)

Walter Roberson
Walter Roberson le 27 Déc 2017

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by