how to create string includes '

2 次查看(过去 30 天)
i have string ['_ ,,,77 - -'''''"''"i''-_G8" ']
but it is illegal how to create it

采纳的回答

Thorsten
Thorsten 2015-4-30
编辑:Thorsten 2015-4-30
Use
''
for every
'
that you need in string, like:
disp('That''s not hard to understand.')
or
>> mystring = '[''_ ,,,77 - -''''''''''"''''"i''''-_G8" '']'
mystring =
['_ ,,,77 - -'''''"''"i''-_G8" ']

更多回答(2 个)

michael scheinfeild
not works b='abc"'
b =
abc"
  1 个评论
Thorsten
Thorsten 2015-4-30
编辑:Thorsten 2015-4-30
' is used in Matlab to indicate the start and end of a string, but the ' are not part of the string. To get the ' as part of the string, you have to type them twice (enclosed by ' to denote a Matlab string):
b='''abc"'''

请先登录,再进行评论。


michael scheinfeild
but the length is ok so it may be helpful to me

类别

Help CenterFile Exchange 中查找有关 String Parsing 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by