Why is this contradiction happening?

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 日

0 投票

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 件)

カテゴリ

ヘルプ センター および File ExchangeProgramming についてさらに検索

質問済み:

2014 年 5 月 23 日

コメント済み:

2014 年 5 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by