Get multiple variables in an input

조회 수: 9 (최근 30일)
Krish Desai
Krish Desai 2015년 11월 10일
편집: per isakson 2015년 11월 10일
What I want to do is to get separate variables for the user inputted "row" and "column". Is there a function I can use to do this? My code so far is:
prompt= 'Enter your next move (‘row’ space ‘column’)'

답변 (1개)

per isakson
per isakson 2015년 11월 10일
편집: per isakson 2015년 11월 10일
Run
cac = inputdlg( 'Enter your next move ( row,col;row,col;...)' );
num = str2num( cac{:} )
and input: &nbsp 1,2;3,4;5,6. &nbsp and get the output
num =
1 2
3 4
5 6
The user may also input two (or any number) whole numbers separated with space.

카테고리

Help CenterFile Exchange에서 Control Systems에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by