How to read .enf file

2 次查看(过去 30 天)
Denni Goodchild
Denni Goodchild 2020-10-28
编辑: per isakson 2020-10-28
I have an .enf file which I would like to load into matlab and search for a variable. I have converted the enf file to a .txt in order to upload here, assistance reading this file would be greatly appreciated. More specifically, I would like to know what FP1, FP2, FP3 and FP4 equal, the rest of the file is of no importance.
Currently, I have used uiopen which opens the .enf file into a tab in matlab but I am unsure as to how I use it from here.

回答(1 个)

per isakson
per isakson 2020-10-28
编辑:per isakson 2020-10-28
A little exercise with regular expression
>> cssm( 'BFND_W6.txt' )
ans =
struct with fields:
FP1: 'Invalid'
FP2: 'Invalid'
FP3: 'Right'
FP4: 'Left'
where
function sas = cssm( ffs )
%%
xpr = ['^FP1\x20*=\x20*(?<FP1>\S+).*' ...
,'^FP2\x20*=\x20*(?<FP2>\S+).*' ...
,'^FP3\x20*=\x20*(?<FP3>\S+).*' ...
,'^FP4\x20*=\x20*(?<FP4>\S+)' ];
sas = regexp( chr, xpr, 'names', 'lineanchors');
end
Comments:
  1. the "rows" of xpr must appear in the same order as the rows in the data file, i.e. FP1,FP2,FP3,FP4
  2. \x20 is a way to indicate space without using space (it's hex).
  3. Space around = isn't needed for this sample file, but just in case.
  4. The first FPn in a "row" is the name in the text file, the next FPn is the name of the resulting structure field.

类别

Help CenterFile Exchange 中查找有关 Large Files and Big Data 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by