M.G. Gouthamanaath
M.G. Gouthamanaath

Reputation: 25

how to input single quotation mark in a text in matlab

trying to input the symbol ' - single quote inside a text will terminate the text. how to give the ' as input inside a text

a='; a='; | Error: String is not terminated properly.

msg='asdfasdfasdf'asdfasdf'; msg='asdfasdfasdf'asdfasdf'; | Error: Unexpected MATLAB expression.

In the first line i am trying to give single quote as input to a variable and in the next line i tried to give single quote in between. but both issues error. how can i solve this. kindly help me.

Upvotes: 0

Views: 1373

Answers (1)

xXliolauXx
xXliolauXx

Reputation: 1313

The answer can be found in many other questions by googling for two seconds... Just use double apostrophe.

msg='abdabc''abcabc';

Or alternatively:

msg=strcat('abcabc', char(39), 'abcabc');

Upvotes: 1

Related Questions