Using load command with regexp
Mostra commenti meno recenti
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 Commenti
per isakson
il 20 Lug 2016
Modificato: per isakson
il 20 Lug 2016
Try
'\<M[a-z]{2}\>'
Michael
il 20 Lug 2016
Risposte (1)
Azzi Abdelmalek
il 20 Lug 2016
load('matFile','-regexp','M[a-z]{2}$')
Categorie
Scopri di più su Characters and Strings in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!