How to open files with extensions .fw13 and extension .OUT

조회 수: 3(최근 30일)
I want to read some files with extension .fw13 and extension .OUT. I want to read the data from these files and manipulate them. Means I want to see data from all colums and row and later manupulate thes data. How can I do it in MATLAB?
  댓글 수: 1
dpb
dpb 2019년 5월 29일
The filename/extension is immaterial; all that matters is the format of the data in the files which we've no clue about.
So, show us a description of the file(s) and we can probably at least give some clues...

댓글을 달려면 로그인하십시오.

채택된 답변

Gazi Alam
Gazi Alam 2019년 5월 30일
You are right. thanks

추가 답변(2개)

Gazi Alam
Gazi Alam 2019년 5월 29일
It has some text as heading.
Then each rows contains text and numeric values. For example columns 1-3 has P25, columns 4-9 has numbers, columns 10-17 has date in the form YYYYMMDD, colums 18-21 has time in the form 0000-2359 and so on. As an example 8th row row
1st to 7th rows has texts i do not read
m25 xypq199004230900B 10 81356 25 10 0 81 0 0 212 352 34

Gazi Alam
Gazi Alam 2019년 5월 29일
I tried exacly as shown in the link, but I have got an error message.
Undefined function or variable 'fixedWidthImportOptions'.
opts = fixedWidthImportOptions('NumVariables',NumVariables,...
filename = fullfile(matlabroot,'examples','matlab','fixed_width_patients_subset_perfect.txt');
DataStartLine = 2;
NumVariables = 7;
VariableNames = {'LastName','Gender','Age','Location','Height',...
'Weight','Smoker'};
VariableWidths = [ 10, 7, 4, 26, 7, ...
7, 7 ] ;
DataType = {'char','categorical','double','char','double',...
'double','logical'};
opts = fixedWidthImportOptions('NumVariables',NumVariables,...
'DataLines',DataStartLine,...
'VariableNames',VariableNames,...
'VariableWidths',VariableWidths,...
'VariableTypes',DataType);
T = readtable(filename,opts)
  댓글 수: 7
Walter Roberson
Walter Roberson 2019년 5월 30일
편집: Walter Roberson 2019년 5월 30일
rmmissing() might help with getting rid of the lines you do not need.
Since you are working with a fixed width object anyhow, combine what you are thinking of as columns 3 and 4 into a single column.
Example: testtable.txt
20190527 1742
20180228 0123
can be read with
filename = 'testtable.txt';
DataStartLine = 1;
NumVariables = 1;
VariableNames(1) = {'dt'};
VariableWidths = [ 13 ];
DataType = {'datetime'};
opts = fixedWidthImportOptions('NumVariables',NumVariables,...
'DataLines',DataStartLine,...
'VariableNames',VariableNames,...
'VariableWidths',VariableWidths,...
'VariableTypes',DataType);
opts = setvaropts(opts,1, 'InputFormat', 'yyyyMMdd HHmm');
T = readtable(filename,opts);
T.dt.Format = 'default';

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by