I have an array of cells in Matlab that all elements in the cell are expressed as:
'"something"'
How can I create an array of
'something'
?
解决方案
Here are two solutions. strrep removes all instances of double quotes, while regexprep only removes double quotes at the start and end of the string (thanks to Gunther Struyf for pointing out that the second regexprep solution would be needed in some scenarios):
>> A = {'"hello"', '"wor"ld"'}
A =
'"hello"' '"wor"ld"'
>> B = strrep(A, '"', '')
B =
'hello' 'world'
>> C = regexprep(A, '^"|"$', '')
C =
'hello' 'wor"ld'