MATLAB: How to remove certain characters from a string in a file

filestrings

how to remove certain characters from a string based on some condition ie i have a text in a file '32/4/5' i want to retain only 32 and delete rest .my condition is if a '/' is identified then rest characters should be deleted .

Best Answer

Similar to @Srinivas, you could try
str = '32/4/5';
str = regexprep(str,'/.*','');