dize ifadesi matlab'da yazılamaz

1 view (last 30 days)
Mevlütcan Üçler
Mevlütcan Üçler on 23 Jan 2023
Commented: Steven Lord on 23 Jan 2023
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 Comment
Askic V
Askic V on 23 Jan 2023
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.

Sign in to comment.

Answers (1)

John D'Errico
John D'Errico on 23 Jan 2023
Edited: John D'Errico on 23 Jan 2023
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 Comment
Steven Lord
Steven Lord on 23 Jan 2023
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.

Sign in to comment.

Categories

Find more on Numeric Types in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!