I have a string that looks like this
I need to be able to pull the number out of that, and I was using the following to do so:
num = regexp(str, '\d+', 'match');
and that worked will I ran into strings like:
When lpdlogic21 is true...
and I started getting numbers that I didn't want, so I switched it to this:
num = regexp(lines{1}{jj}, '(?<words>\w*).(?<ID>\d*)', 'names');
but this didn't work for the off string either. It gave me num with about 20 entries in it. So my question is what can I use so I only get answers for the first string but none of the others. This is a basic question and I know I should know this by now, but I'm drawing a blank right now.
댓글 수: 1
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/48006-get-number-from-a-string#comment_98997
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/48006-get-number-from-a-string#comment_98997
댓글을 달려면 로그인하십시오.