Uppercase string from the cell array
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Gopalakrishnan venkatesan
am 12 Aug. 2015
Bearbeitet: Stephen23
am 12 Aug. 2015
I have a cell array a = {'AA_DFA_DD' ,'DSFA_dfaf' ,'DDDD' , 'DFE1' ,'dfs_DD'}
How can extract only the upper case string from the cell array
my answer should be {'AA_DFA_DD',[],'DDDD','DFE1',[]}
How can i do this?
Thanks a lot
1 Kommentar
Akzeptierte Antwort
Stephen23
am 12 Aug. 2015
Bearbeitet: Stephen23
am 12 Aug. 2015
regexp(a,'^[^a-z]+$','match')
Weitere Antworten (1)
Azzi Abdelmalek
am 12 Aug. 2015
Bearbeitet: Azzi Abdelmalek
am 12 Aug. 2015
out=a(cellfun(@(x,y) isequal(x,y),a,upper(a)))
or
out=cell(size(a))
idx=cellfun(@(x,y) isequal(x,y),a,upper(a))
out(idx)=a(idx)
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!