Delete the 4 last digits of a message

조회 수: 1 (최근 30일)
flashpode
flashpode 2021년 7월 14일
댓글: flashpode 2021년 7월 14일
what I am tryng to do is to delete the las 4 digits of a message and I do not how to do it for a big amount of messages. the type of messages that I have have number comas and leters but the last are numbers and always diferent. I am thinking of using this functions:
fname
Please help.

답변 (1개)

KSSV
KSSV 2021년 7월 14일
편집: KSSV 2021년 7월 14일
str = 'Hello World'
str = 'Hello World'
str(end-3:end) = []
str = 'Hello W'
  댓글 수: 3
Walter Roberson
Walter Roberson 2021년 7월 14일
output = regexprep(AIS1, '\d\d\d\d$', '')
This will delete the last 4 characters provided they are digits. It does not "delete the last four digits", so it would leave "ABC12345D" unchanged, and likewise it would leave "AB123D45" unchanged where "last four digits" would require "AB1D" as output
flashpode
flashpode 2021년 7월 14일
really useful thank youuu

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by