how characters connected in quotes

1 view (last 30 days)
Hello,
I am complete beginer. Cannot find answers on the web, and don't know how to search the answer.
I don't know the rules of connecting the characters in the quotes. Wonder what makes a difference of the double and trible and space in the rule of connection
excute the following command
['a'' b ' '''c''']
['a'' b ' ''' c ''']
['a','b']
['a' 'b']
['a'' b ']
the answers are the following
ans =
'a' b 'c''
ans =
'a' b ' c ''
ans =
'ab'
ans =
'ab'
ans =
'a' b '
Any explanation and ways to teach me how to find the answer are all appreciated. Many thanks!

Accepted Answer

Star Strider
Star Strider on 15 Feb 2020
See the char documentation for information on character arrays, and string for information on string arrays.
Those should provide the information you likely need, and an introduction to the online documentation.
To find that information in your own MATLAB installation, type:
doc char
doc string
in your Command Window or a script (then run the script).
  2 Comments
Qian Li
Qian Li on 16 Feb 2020
Thanks for the help! Cannot fine relevant explanation on my problem using the doc command. But asked a friend, who gave me the answer: just return '' in '...' as a singel ' in '...', and space or comma seperate the character as two characters and connect then in the usual way.
Star Strider
Star Strider on 16 Feb 2020
As always, my pleasure!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!