Find a line in a header of an IMG file
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Elena H.
le 30 Juil 2015
Réponse apportée : Walter Roberson
le 30 Juil 2015
Hi
I have these IMG files (an example is attached resaved as a txt) where I'm looking to extract specific lines (namely the 38th line, PLANET_DAY_NUMBER = [value]) from many of these files.
I would like to start out by making a code that finds the specified value in a given IMG file and outputs it (so basically grabbing the value of planet day number and showing me what that number is). I can figure out how to expand upon this basic idea so I can apply the code to a batch of files, but I'm not sure what to use to grab the string I want in the first place.
Can anyone help?
Also, I will give any clarification necessary, this might not have been super clear.
0 commentaires
Réponse acceptée
Walter Roberson
le 30 Juil 2015
filestring = fileread('1n128464653ffl0200p1516l0m1.txt');
pdn = regexp(filestring, '^(?<=PLANET_DAY_NUMBER\s*=\s*).*$', 'match', 'lineanchors', 'dotexceptnewline');
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!