importing .las data as table for analysis.
显示 更早的评论
Dear all, I am using Matlab to analyse some data. The data are in .las format versions from 1 to 3. I can't use readtable as it gives me unknown file format error "Error using readtable (line 198) The file extension '.las' is not recognized." Any idea how to import these files into tables? Thanks
采纳的回答
7 个评论
Thanks Walter.
I'm trying adding path but got this warnings:
>> addpath ('C:\SeisLab_10.0301\S4M\Examples','C:\SeisLab_10.0301\S4M\Geophysics_3.0','C:\SeisLab_10.0301\S4M\Geophysics_3.0\private','C:\SeisLab_10.0301\S4M\Geophysics_3.0\@struct','C:\SeisLab_10.0301\S4M\Other','C:\SeisLab_10.0301\S4M\TestData')
Warning: Private directories not allowed in MATLAB path: C:\SeisLab_10.0301\S4M\Geophysics_3.0\private
> In path (line 109)
In addpath (line 88)
Warning: Method directories not allowed in MATLAB path: C:\SeisLab_10.0301\S4M\Geophysics_3.0\@struct
> In path (line 109)
In addpath (line 88)
Any suggestions?
Remove C:\SeisLab_10.0301\S4M\Geophysics_3.0\private from the list.
Hi Walter,
The tool is working now but can not read the las files.
I have tried to make it read two files, the first, las1, got the following:
>> wlog=read_las_file('las1.txt')
File "las1.txt" not found. Select file interactively.
File C:\Users\19067654\Documents\PhD\Practical\Coal_DT\las1.las interactively selected
wlog =
struct with fields:
type: 'well_log'
tag: 'unspecified'
name: 'las1'
first: 152.5000
last: 1.3895e+03
step: 0.5000
units: 'm'
null: []
from: 'las1.las'
curve_info: {'depth' 'm' ''}
curves: [2475×1 double]
wellname: 'AAO_ANABRANCH_1'
the second file gave me these errors:
>> wlog=read_las_file('las3.las')
Subscripted assignment dimension mismatch.
Error in interpret_las2>data_section_no4 (line 269)
curves(ii,:)=sscanf(tlines{ii},'%g')';
Error in interpret_las2 (line 55)
wlog=data_section_no4(wlog,tlines(index(ii)+1:index(ii+1)-1),wrap);
Error in read_las_file (line 107)
wlog=interpret_las2(tlines(3:end));
Both files are attached for your reference, I've changed the extension to txt to be able to upload.
Regards
Moustafa
The curve definition section for las2 ends in
SSN .SSNU : SHORT SPACED NEUTRON Reversed.
indicating that a column entitled SSN is expected. However, there is no such column in the ~A section. The file would probably work if you deleted that line.
Thanks for your help Walter! It's working now.
I would appreciate if you could help me to extract the curves into a table and use the curves' names as column name.
Regards Moustafa
array2table(wlog.curves, 'VariableNames', wlog.curve_info(1,:))
Tried the command and got the following error
>> las=array2table(wlog.curves, 'VariableNames', wlog.curve_info(1,:));
Error using matlab.internal.tabular.private.varNamesDim.makeValidName (line 433)
'DEPTH Reversed.' is not a valid variable name.
Error in matlab.internal.tabular.private.varNamesDim/validateAndAssignLabels (line 311)
[newLabels,wasMadeValid] = obj.makeValidName(newLabels,exceptionMode);
Error in matlab.internal.tabular.private.tabularDimension/setLabels (line 173)
obj = obj.validateAndAssignLabels(newLabels,indices,fullAssignment,fixDups,fixEmpties,fixIllegal);
Error in matlab.internal.tabular.private.tabularDimension/createLike_impl (line 355)
obj = obj.setLabels(dimLabels,[]);
Error in matlab.internal.tabular.private.varNamesDim/createLike (line 70)
obj = obj.createLike_impl(dimLength,dimLabels);
Error in tabular/initInternals (line 207)
t.varDim = t.varDim.createLike(nvars,varnames); % error if invalid, duplicate, or empty
Error in table.init (line 327)
t = initInternals(t, vars, numRows, rowLabels, numVars, varnames);
Error in array2table (line 64)
t = table.init(vars,nrows,rownames,nvars,varnames);
Then I created a new variable that has the names in a row as following
>> wlog.curve_name=(wlog.curve_info(:,1))'
wlog =
struct with fields:
type: 'well_log'
tag: 'unspecified'
name: 'las3'
first: 221.1000
last: 523
step: 0.1000
units: 'm'
null: NaN
from: 'las3.las'
curve_info: {17×3 cell}
curves: [3020×17 double]
company: 'M.I.M. HOLDINGS LIMITED'
wellname: 'MIH_EMERALD_1'
field: 'ATP 447P'
location: 'EMERALD'
province: 'QUEENSLAND'
service: 'BPB Wireline Services'
date: '5-JUL-1992'
wellid: 'MIM E01 TD'
curve_name: {1×17 cell}
and tried the modified code
las=array2table(wlog.curves, 'VariableNames',wlog.curve_name);
and the table was created successfully.
Thanks for your help
Moustafa
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 String Parsing 的更多信息
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
