Using load command with regexp

조회 수: 6 (최근 30일)
Michael
Michael 2016년 7월 20일
댓글: Michael 2016년 7월 20일
Hi, I'd like to load only variables from a mat file that start with an upper case M followed by exactly 2 lower case letters. I've tried the following:
load(matFile,'-regexp','M[a-z]{2}')
but I get all variables with at least 2 lower case letters behind the M. For example, I get 'Mab', but I also get 'Mabc'.
I've tried many other regular expression patterns, but can't figure this out. Is this a bug in Matlab's regexp parser?
Thanks, -mcd
  댓글 수: 2
Michael
Michael 2016년 7월 20일
That did the trick. Thanks!

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

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2016년 7월 20일
load('matFile','-regexp','M[a-z]{2}$')

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by