Why is this contradiction happening?

조회 수: 2 (최근 30일)
DIJESH
DIJESH 2014년 5월 23일
댓글: DIJESH 2014년 5월 23일
prompt = {'Angle (degrees)'};
title = 'Angle';
answer = inputdlg(prompt,title);
alpha = answer{1}
a = degtorad(alpha)
b = degtorad(0)
If you run this program..you can see that a and b values are different but both must be equal to 0. first i thought 'alpha' was reading the answer differently. but even it is 0. even then the value of a is still not 0. can anyone explain y? and how can get the value of a as 0?

채택된 답변

Mischa Kim
Mischa Kim 2014년 5월 23일
Use
alpha = str2num(answer{1})
instead. answer{1} is a string that needs to be converted first.
  댓글 수: 1
DIJESH
DIJESH 2014년 5월 23일
oops..thats was simple :) thnx again

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

추가 답변 (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