dize ifadesi matlab'da yazılamaz

조회 수: 1 (최근 30일)
Mevlütcan Üçler
Mevlütcan Üçler 2023년 1월 23일
댓글: Steven Lord 2023년 1월 23일
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
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
John D'Errico 2023년 1월 23일
편집: John D'Errico 2023년 1월 23일
Sure it does.
S = "Hellow World"
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
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 CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by