MATLAB: How can i use ‘ character in a string

stringstring char

Hi
How can i merge two seperate strings into one string, for instance;
I want to create a variable like that :
>> 'materialproperties/uniaxialelement.txt' which contains ' character inside.
So i use
A=' ' '; B='materialproperties/uniaxialelement.txt'
FD={ A B A};
but it doesnt work
Can u you help me ?

Best Answer

How to create character arrays (including single quotes) is described in the documentation:
To get a literal single quote you just need to double it, e.g.:
>> FD = '''materialproperties/uniaxialelement.txt'''
FD = 'materialproperties/uniaxialelement.txt'
Or if you want to define a single quote by itself:
>> A = '''' % one single quote by itself
A = '
>> B = 'materialproperties/uniaxialelement.txt'
B = materialproperties/uniaxialelement.txt
>> FD = [A,B,A] % concatenate
FD = 'materialproperties/uniaxialelement.txt'