matlab处理h5文件

1、把两个h5文件合并为一个。
h5Splicing(h5NameSou, ‘/’, h5NameDst, cellNum, 1);

function h5Splicing(singleCellFileName, currentGroupName, multiCellsFileName, currentCellName,upDown)
    info = h5info(singleCellFileName, currentGroupName);
    for datasetIndex = 1:size(info.Datasets)
        fullDatasetName = [currentGroupName, '/', info.Datasets(datasetIndex).Name];
%         disp(fullDatasetName);
        data = h5read(singleCellFileName,fullDatasetName);
        if upDown == 1
            fullDatasetName = strrep(fullDatasetName, 'Cell0', currentCellName);
        end
        h5create(multiCellsFileName,fullDatasetName,info.Datasets(datasetIndex).Dataspace.Size,'Datatype','uint32');
        h5write(multiCellsFileName,fullDatasetName,data);
    end
    for groupIndex = 1:size(info.Groups)
        h5Splicing(singleCellFileName, info.Groups(groupIndex).Name, multiCellsFileName, currentCellName, upDown);
    end
end

你可能感兴趣的:(matlab)