how do I remove special characters from my cell array strings?

43 views (last 30 days)
I have a cell array of the sorts:
{'508-647-7000'} {' (508) 647-7001'} {' 617-555-1212'}
I need the special characters and the spaces removed from these. The result should look something like this:
{'5086477000'} {'5086477001'} {'6175551212'}
I tried writing the following cell function to do it:
characters = ['(',')',' ','-'];
s_nos=cellfun(@(x) x~=characters,s_split, 'UniformOutput', false);
but I am getting the following error: * Matrix dimensions must agree.*
Kindly help.

Sign in to comment.

Accepted Answer

Srishti Saha
Srishti Saha on 8 Apr 2018
This worked for me

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by