dize ifadesi matlab'da yazılamaz
1 回表示 (過去 30 日間)
古いコメントを表示
matlab does not allow the use of double quotes when writing string expressions.the left side turns red, the right side turns pink, and the fixed "Input character is not valid in MATLAB expressions or expressions. " i take his mistake
1 件のコメント
Askic V
2023 年 1 月 23 日
You didn't specify which version you use.
For example, this is valid Matlab 2022b expression
test_str = "Hello World"
I believe this is valid expression in Matlab's versions for at least 5 years or more.
回答 (1 件)
John D'Errico
2023 年 1 月 23 日
編集済み: John D'Errico
2023 年 1 月 23 日
Sure it does.
S = "Hellow World"
However, it is likely that you have an older release of MATLAB, which may not allow the use of those double quoted strings. That capability was introduced only a few years back.
The doc for string tells me they were introduced in R2016b, so the word "few" may be a subjective term.
1 件のコメント
Steven Lord
2023 年 1 月 23 日
The ability to create a string using double quotes as opposed to calling string on a char array was introduced in release R2017a. If the poster was using release R2016b this would work:
s = string('Hello world!')
but this would not.
s = "Hello world!"
They would both work starting in release R2017a. I found this information in one of the documentation pages for string arrays in an older release of MATLAB; I'm guessing since pre-R2017a documentation is no longer available online that information has been removed from recent versions of those documentation pages.
参考
カテゴリ
Help Center および File Exchange で Numeric Types についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!