How do you delete text data from a row if its characters are equal to or less than 3
Show older comments
I have a 163x1 row of text data, the data that I would like to replace with "" has 3 characters, while the data I want to keep has greater than 3 characters. Below is a section of the data:
'Trinidad & Tobago' 'USD' 'Turkey' 'TRY' 'USD' 'Uganda' 'UGX' 'Ukraine' 'USD' 'United Arab Emirates' 'USD' 'United Kingdom' 'USD' 'United States' 'USD' 'Uruguay' 'UYU' 'Zambia' 'USD' 'NA' 'BRL' 'COP' 'CZK' 'EUR'
1 Comment
the cyclist
on 7 Aug 2017
How are these data currently stored? For example, do you have them in a cell array? Or in a CSV file, not yet loaded into MATLAB?
Accepted Answer
More Answers (1)
Andrei Bobrov
on 7 Aug 2017
a = string({'Trinidad & Tobago'
'USD'
'Turkey'
'TRY'
'USD'
'Uganda'
'UGX'
'Ukraine'
'USD'
'United Arab Emirates'
'USD'
'United Kingdom'
'USD'
'United States'
'USD'
'Uruguay'
'UYU'
'Zambia'
'USD'
'NA'
'BRL'
'COP'
'CZK'
'EUR'});
a(strlength(a) <= 3)="";
Categories
Find more on Simulink Check in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!