How to get rid of double quotes in a Matlab cell?

I have an array of cells in Matlab that all elements in a cell are expressed as:

'"something"' 

How to create an array

 'something' 

?

+4
source share
1 answer

Here are two solutions. strrep removes all instances of double quotes, while regexprep removes only double quotes at the beginning and end of a line (thanks to Gunther Struyf for requiring a second regexprep solution in some scenarios):

 >> A = {'"hello"', '"wor"ld"'} A = '"hello"' '"wor"ld"' >> B = strrep(A, '"', '') B = 'hello' 'world' >> C = regexprep(A, '^"|"$', '') C = 'hello' 'wor"ld' 
+6
source

Source: https://habr.com/ru/post/1444718/


All Articles