Requesting input in a certain format.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
ck
am 28 Jun. 2016
Beantwortet: Image Analyst
am 28 Jun. 2016
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.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 28 Jun. 2016
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.
0 Kommentare
Weitere Antworten (1)
Image Analyst
am 28 Jun. 2016
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?
Maybe you'd like to take a look at MAGIC: http://www.mathworks.com/matlabcentral/fileexchange/24224-magic-matlab-generic-imaging-component
0 Kommentare
Siehe auch
Kategorien
Mehr zu Environment and Settings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!