filtering cell array table
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want to filter the cell array column according to 'DD. mmmm YYYY' so I get only the dates. How can I do that? thanks
'Thu, Feb-14-13'
'Thu, Feb-07-13'
'Thu, Jan-31-13'
'Thu, Jan-24-13'
'Thu, Jan-17-13'
'Thu, Jan-10-13'
'Thu, Jan-03-13'
'Thu, Dec-27-12'
'Thu, Dec-20-12'
'Time'
'Time'
'Reg.'
'Reg.'
'UXS'
'CXX'
'UCC'
'USDC'
'USCCD'
0 commentaires
Réponse acceptée
Walter Roberson
le 10 Oct 2015
Why did you delete your earlier question? I was busy posting an answer to it and it disappeared out from under me :(
Good thing I saved the answer:
matchresult = regexp(YourCell, '^[a-zA-Z]{3},\s[a-zA-Z]{3}-\d{2}-\d{2}$');
nomatch = cellfun(@isempty, matchresult);
dateless = YourCell(nomatch);
datelike = YourCell{~nomatch};
Caution: this will not accept single digit day of the month as being a date. But it will accept any three letters as potential weekday name or month name. It will also not accept spaces before or after the date. (Some of these are easy to change but I am sticking with the format that you presented.)
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Whos dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!