How to cut the end of a string which follows a special character?
Mostrar comentarios más antiguos
For example: 'sahdklsjf_sdfs' to 'sahdklsjf'
2 comentarios
Mr M.
el 26 de Mayo de 2015
David Young
el 26 de Mayo de 2015
mfilename is a function, so it can't be indexed. Assigning its result to a variable then gives you a string which can be indexed.
Respuestas (3)
Jan
el 26 de Mayo de 2015
S = 'sahdklsjf_sdfs'
Part = strtok(S, '_');
Thorsten
el 26 de Mayo de 2015
regexp('sahdklsjf_sdfs', '(^[a-zA-Z]*)', 'match')
Jos (10584)
el 26 de Mayo de 2015
Many options, including:
str = 'sahdklsjf_sdfs'
out1 = str(1:find([str '_']=='_',1,'first'))
Also take a look at TEXTSCAN
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!