Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

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

1 Ansicht (letzte 30 Tage)
Ahmed Khalil
Ahmed Khalil am 27 Dez. 2017
Geschlossen: MATLAB Answer Bot am 20 Aug. 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!

Antworten (1)

Walter Roberson
Walter Roberson am 27 Dez. 2017

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by