Alex
Alex

Reputation: 325

Need to get rid of single quote character (') in MATLAB string array

I have a string array in MATLAB '''''''xxxxx''''''', and I want only xxxxx. How can I achieve this?

Upvotes: 0

Views: 3887

Answers (2)

Dennis Jaheruddin
Dennis Jaheruddin

Reputation: 21563

You really need a lot of quotes to represent just one! Here is the code to remove all quotes:

x(x=='''')=[]

Upvotes: 0

Marcin
Marcin

Reputation: 238597

This should do the trick:

s='''''''xxxxx''''''';
newS = strrep(s, '''', '');

newS =

xxxxx

Upvotes: 2

Related Questions