Reputation: 77
I have a 400 x 8 char in which I would like to delete empty spaces. I have numbers like this:
1, 99278; 4, 99378; 1,101283;
I would need to have:
1,99278; 4,99378; 1,101283;
Thanks a lot!
Upvotes: 1
Views: 6422
Reputation: 210
Try this:
stringWithoutSpaces = originalString(~isspace(originalString))
Upvotes: 0
Reputation: 112759
It appears you want to remove spaces after commas, but not after semicolons. You can do that easily with regexprep
:
>> str = '1, 99278; 4, 99378; 1,101283;';
>> result = regexprep(str, ',\s+', ',');
result =
1,99278; 4,99378; 1,101283;
Upvotes: 4