Getting data in real time

1 回表示 (過去 30 日間)
Mahesh
Mahesh 2014 年 2 月 25 日
編集済み: dpb 2014 年 2 月 25 日
Is it possible to get integer data in Matlab R2010a during program execution as in C/C++

回答 (1 件)

dpb
dpb 2014 年 2 月 25 日
Yes
  2 件のコメント
Mahesh
Mahesh 2014 年 2 月 25 日
I have tried using inputdlg but the input I give is not read as an integer. So which function should I use for this purpose
dpb
dpb 2014 年 2 月 25 日
編集済み: dpb 2014 年 2 月 25 日
Matlab doesn't strongly type variables and Matlab is NOT C/C++ (nor Fortran nor any other language specifically). The default numeric value is a double. There's nothing wrong in general in storing an integer in a double and going on--that's almost always how it's done in Matlab.
If there's some specific reason you must have an integer, then use one of the intN casting functions to cast to the desired type.
Why must it actually be an integer; you can always also use fix or round to ensure the user input is an integer value on return.
I don't actually mess w/ GUIs and so whether there's a more restrictive dialog pre-packaged in Matlab that handles preventing a user from entering anything except digits I'm unaware.
You might look on the File Exchange for such enhancements if that's what you're actually asking for.
ADDENDUM: Indeed,
may be "the cat's meow"...

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by