|
"Christopher " <christopher.f.nyland@us.army.mil> wrote in message <h163k2$b6a$1@fred.mathworks.com>...
> I have been experiancing the same problem with the slow down especially when pulling small amounts of data from many different places such as multipule attributes. So you say that you have written function to call the mex functions directly. I was unable to find the mex functions in my matlab root directory. Do you mean that you wrote mex functions to call the c - code possibly. I have been thinking of this as an alternative since the c code is aviable on the hdf5 website. I have been also looking at python as a possible place to proccess this data but the only interface to the c code files I have found is pytables and as far as I can tell it is too restrictive in the way it writes data. I would be interested in your functions if you could post them to the exchange
The Mex functions are called, I guess, by hdf5lib2. My code, for example:
function [sObj,sAttr,oEx] = ReadTable(dLocId,strds,varargin)
% +PHdf.PH5ts/ReadTable 读取全部成员的全部记录。
%
% 使用说明:
% sObj = PHdf.PH5ts.ReadTable(dLocId,strds);
% [sObj,sAttr,oEx] = PHdf.PH5ts.ReadTable(dLocId,strds,clAttr);
% 输入参数:
% dLocId——文件或群组辨识符。
% strds——数据集(表格)的名称。
% clAttr——需要读取的属性名称,如果为空则不读取属性。
% 输出参数:
% sObj——读取数据的结构。
% sAttr——属性结构。
% oEx——执行成功返回[],否则返回MException实例。
%
% 例如:
%{
clear classes;
tic
strf = [PDir.EtfGoRoot(),'EtfGo\Dbase\+PEtfH\fTest.H5'];
oGath = PEtfH.HCodeTs(strf,'/Qut','/fCode');
oGath.dLocId = H5F.open(oGath.strf,'H5F_ACC_RDONLY','H5P_DEFAULT');
% 读取数据。
oCode = PEtfH.HCode(); oCode.oGath = oGath;
ReadTable(oCode);
%[num2cell(oCode.dCode),oCode.clChNm]
H5F.close(oGath.dLocId);
toc
%}
% 作者: 卢晨曦,2010/7/1
% Copyright 2004-2010,仟斯数码
% $修订版:4.0 $ $日期:2010/7/1 16:57:38 $
try
% 定位辨识符:
%{
strf = H5F.get_name(dLocId)
sInfo = hdf5info(strf,'ReadAttributes',true)
sInfo.GroupHierarchy.Attributes.Value(2)
%}
% 1. 数据集
% sInfo = PHdf.PH5d.GetInfo(dDsetId)
dDsetId = H5D.open(dLocId,strds,'H5P_DEFAULT');
% 2. 读取数据
% dMTId = H5ML.get_mem_datatype(dDsetId)
% sInfo = PHdf.PH5t.GetMemberInfo(dMTId)
sObj = H5D.read(dDsetId,'H5ML_DEFAULT','H5S_ALL','H5S_ALL','H5P_DEFAULT');
%{
% 逐列读取已经通过测试。
dFTId = H5D.get_type(dDsetId);
dNoCols = H5T.get_nmembers(dFTId);
for dNoC = 1:dNoCols
strFld = H5T.get_member_name(dFTId,dNoC-1);
dBscId = H5ML.get_mem_datatype(H5T.get_member_type(dFTId,dNoC-1));
dColTId = H5T.create('H5T_COMPOUND',H5T.get_size(dBscId));
H5T.insert(dColTId,strFld,0,dBscId);
sTmp = H5D.read(dDsetId,dColTId,'H5S_ALL','H5S_ALL','H5P_DEFAULT');
sObj.(strFld) = sTmp.(strFld);
H5T.close(dBscId);
H5T.close(dColTId);
end
%}
% 3. 读取属性
if(isempty(varargin) || isempty(varargin{1}))
sAttr = [];
else
sAttr = PHdf.PH5ts.PH5a.ReadMsStruct(dDsetId,varargin{1});
end
% 4. 关闭
H5D.close(dDsetId);
oEx = [];
catch oEx
%PFig.ShowWarn(PMException.GetReport(oEx),'警告','modal');
try H5D.close(dDsetId); catch, end
sObj = [];
end
|