Using load command with regexp

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 件のコメント

per isakson
per isakson 2016 年 7 月 20 日
編集済み: per isakson 2016 年 7 月 20 日
Michael
Michael 2016 年 7 月 20 日
That did the trick. Thanks!

サインインしてコメントする。

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 7 月 20 日

0 投票

load('matFile','-regexp','M[a-z]{2}$')

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

製品

質問済み:

2016 年 7 月 20 日

コメント済み:

2016 年 7 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by