Add Value to GUI
이전 댓글 표시
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
채택된 답변
추가 답변 (4개)
Matt Kindig
2012년 5월 24일
To clarify, you are trying to make a GUI? Are you going to replace the calls to 'input' (which gets information from the command prompt) with text fields in the GUI (where you can type in the relevant information directly? If so, you should start with GUIDE, which will help you layout the GUI. There are a few examples in the startup for GUIDE to do things similar to your task.
At the command prompt, simply type
guide
댓글 수: 3
Özgür Karagülle
2012년 5월 24일
Özgür Karagülle
2012년 5월 24일
Walter Roberson
2012년 5월 24일
vals = inputdlg('Phone book', 'name', 'number', 'address');
Phone(ii).name = vals{1};
...
Özgür Karagülle
2012년 5월 24일
0 개 추천
댓글 수: 1
Walter Roberson
2012년 5월 24일
n = 2
for ii = 1:n
vals = inputdlg('Phone book', 'name', 'number', 'address');
Phone(ii).name = vals{1};
Phone(ii).number = vals{2};
Phone(ii).address = vals{3};
end
Özgür Karagülle
2012년 5월 24일
0 개 추천
댓글 수: 3
Walter Roberson
2012년 5월 24일
Most of the MATLAB Answers volunteers are employed and can only answer in their spare time.
Oleg Komarov
2012년 5월 24일
@Özgür: please do not create additional answer but use comments or edit the original post.
I would suggest to avoid the GUI if you are new to MATLAB and interact with the user through the command line.
Özgür Karagülle
2012년 5월 24일
Özgür Karagülle
2012년 5월 24일
0 개 추천
댓글 수: 4
Oleg Komarov
2012년 5월 24일
As you can see, now it's hard to understand which of Walter's comments this answer coprresponds to.
Özgür Karagülle
2012년 5월 24일
Image Analyst
2012년 5월 25일
That's not the right way to use inputdlg() - see the help for the correct way.
Walter Roberson
2012년 5월 25일
vals = inputdlg({ 'name', 'number', 'address'},'Phone Book');
카테고리
도움말 센터 및 File Exchange에서 MATLAB Mobile에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!