Clean characters of strings in column
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Kushal Kharel
il 27 Dic 2020
Commentato: Kushal Kharel
il 27 Dic 2020
Hello Everyone,
I downloaded and loaded a dataset for NBA players. I would like to clean column Players to get just player names in that column. How would I do that? I have shown sample of output below. This is a second column from my table.
PLAYER
"Steven Adams\adamsst01"
"Bam Adebayo\adebaba01"
"LaMarcus Aldridge\aldrila01"
"Kyle Alexander\alexaky01"
"Nickeil Alexander-Walker\alexani01"
"Grayson Allen\allengr01"
"Jarrett Allen\allenja01"
"Kadeem Allen\allenka01"
"Al-Farouq Aminu\aminual01"
"Justin Anderson\anderju01"
"Kyle Anderson\anderky01"
0 Commenti
Risposta accettata
Più risposte (1)
Image Analyst
il 27 Dic 2020
for k = 1 : length(players)
thisPlayer = players{k}; % get this string.
slashLocation = find(thisPlayer == '\', 1, 'first') % Find location of slash
if ~isempty(slashLocation)
players{k} = thisPlayer(1 : slashLocation-1); % if a slash was found, take up until just before that slash location.
end
end
Vedere anche
Categorie
Scopri di più su Characters and Strings in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!