필터 지우기
필터 지우기

How do we accept values and store them in a column array in a gui component like an edit box?

조회 수: 2 (최근 30일)
I have a gui and would like to accept various values from user and store them in a column array..For eg. if the values he enters are 6,4,7,3,8 my gui has to store them in an array like A=[6;4;7;3;8].
Please suggest a sample code if possible..Thanks.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2012년 8월 21일
use an "Edit text" object
set(handles.EdittextName,'String','[0 0 0 0]')
a user has just to fill the Edit text object with desired values
to get these data use
A = str2num(get(handles.edit2,'String'));
  댓글 수: 3
Nitin Samuel
Nitin Samuel 2012년 8월 21일
편집: Nitin Samuel 2012년 8월 21일
how does this code account for a variable sized array? coz the size of my array differs according to the number of inputs the user gives..
Ken
Ken 2012년 9월 20일
If you simply have [] around whatever you want the text to say it should work regardless of the size of the array.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by