필터 지우기
필터 지우기

Requesting input in a certain format.

조회 수: 1 (최근 30일)
ck
ck 2016년 6월 28일
답변: Image Analyst 2016년 6월 28일
Suppose we should get 4 variables such as age,gender,height,birth date, instead of taking it in four lines I want to take input in a certain matrix such as [a b c d], where a,b,c,d are required variables say a= age, b=gender,c=height,d=birth date.
so if I give [40 'm' 5.7 6.15.1995], it show acquire the values for further processes . How can I do it?
Thank you.

채택된 답변

Walter Roberson
Walter Roberson 2016년 6월 28일
Use the 's' option for input() to get a string, and then parse the string.
Alternately, require that the user enter
{40 'm' 5.7 '6.15.1995'}
the {} is required in order to mix numeric and string.

추가 답변 (1개)

Image Analyst
Image Analyst 2016년 6월 28일
I don't know why you want to "take it as a matrix". Why not simply use inputdlg where you get one field for each entry, or else build your own GUI with GUIDE and have edit fields for each?

카테고리

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