MATLAB: Add Value to GUI

arrayguipushbutton

Hi! I take an answer 3 minutes ago. With the answer i can take values for my array Phone. Now i want to add this script to GUI. in the gui there is just one push button it is goin to be "add phone number". so How i can add this script to gui ?
n = 2
for ii = 1:n
Phone(ii).name = input('Enter the name: ', 's');
Phone(ii).number = input('Enter the phone number: ','s');
Phone(ii).address = input('Enter the address: ','s');
end

Best Answer

n = 2;
dlg_title = 'Input for personal data';
num_lines = 1;
for k = 1:n
prompt1 = sprintf('Enter name #%d', k);
prompt2 = sprintf('Enter phone number #%d', k);
prompt3 = sprintf('Enter address #%d', k);
prompt = {prompt1, prompt2, prompt3};
answer = inputdlg(prompt,dlg_title,num_lines);
Phone(k).name = answer{1};
Phone(k).number = answer{2};
Phone(k).address = answer{3};
end