Can I only declare a variable NOT define.
1 回表示 (過去 30 日間)
古いコメントを表示
When I make a program, I've got a question. In C/C++, before using a variable, should define or at least declare the variable like the following.
int a;
or
int a = 2;
However in MATLAB, Can I just declare a variable? In other words, is
variable;
varid?
0 件のコメント
採用された回答
José-Luis
2017 年 8 月 23 日
編集済み: José-Luis
2017 年 8 月 23 日
No. Different paradigm. Matlab is weakly typed. Double is the default type. Implicit conversions everywhere.
dummy = '3' * 5
Even funnier:
dummy = 'θ' - pi
If you need it to exist before using it (why?), you can declare it to be empty.
a = [];
And go on your merry way.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で MATLAB에서 C++ 라이브러리 についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!