필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

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

조회 수: 1 (최근 30일)
Ahmed Khalil
Ahmed Khalil 2017년 12월 27일
마감: MATLAB Answer Bot 2021년 8월 20일
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!

답변 (1개)

Walter Roberson
Walter Roberson 2017년 12월 27일

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by