how to create string includes '

2 visualizaciones (últimos 30 días)
michael scheinfeild
michael scheinfeild el 30 de Abr. de 2015
Editada: Thorsten el 30 de Abr. de 2015
i have string ['_ ,,,77 - -'''''"''"i''-_G8" ']
but it is illegal how to create it

Respuesta aceptada

Thorsten
Thorsten el 30 de Abr. de 2015
Editada: Thorsten el 30 de Abr. de 2015
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" ']

Más respuestas (2)

michael scheinfeild
michael scheinfeild el 30 de Abr. de 2015
not works b='abc"'
b =
abc"
  1 comentario
Thorsten
Thorsten el 30 de Abr. de 2015
Editada: Thorsten el 30 de Abr. de 2015
' 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"'''

Iniciar sesión para comentar.


michael scheinfeild
michael scheinfeild el 30 de Abr. de 2015
but the length is ok so it may be helpful to me

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by