0

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.

4

1 回答 1

1

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');
于 2015-12-07T06:39:42.020 回答