Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

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

1 visualizzazione (ultimi 30 giorni)
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!

Risposte (1)

Walter Roberson
Walter Roberson il 27 Dic 2017

Community Treasure Hunt

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

Start Hunting!

Translated by