Using load command with regexp

2 Ansichten (letzte 30 Tage)
Michael
Michael am 20 Jul. 2016
Kommentiert: Michael am 20 Jul. 2016
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 Kommentare
Michael
Michael am 20 Jul. 2016
That did the trick. Thanks!

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 20 Jul. 2016
load('matFile','-regexp','M[a-z]{2}$')

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by