getting the data from the inputdlg box

조회 수: 5 (최근 30일)
Max
Max 2012년 2월 25일
편집: Matt J 2013년 10월 25일
I have the following codes ..where i have given two variables
  1. distance of sensor from system
  2. Set point in mm
prompt={'Enter the distance of sensor from system',...
'Enter the set point in mm:'};
name='Input of control system';
numlines=1;
defaultanswer={'45','125'};
answer=inputdlg(prompt,name,numlines,defaultanswer);
Now when i use these codes value of both the variables are stored in the variable answer..
when in workspace i type following things happen
>> answer
'45'
'125'
here its a cell ..but i want to use it as an input by user without cell..
suggest a way to perform this

채택된 답변

Walter Roberson
Walter Roberson 2012년 2월 25일
There is no way to do that in MATLAB without creating a temporary variable (such as "answer") to hold the values. Once the temporary variable is created, you can use (for example)
[sensdist, setpoint] = answer{:};
  댓글 수: 1
Max
Max 2012년 2월 25일
thanks walter it worked.....thanks so much

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by