Import hdf5 file into Matlab

10 vues (au cours des 30 derniers jours)
Peng
Peng le 21 Juil 2015
Modifié(e) : per isakson le 13 Sep 2015
Hi, I am trying to use Matlab to import an hdf5 file. I am wondering if someone can help me figure out how to import the data. I attached the hdf5 file.
I used
h5info('L_600_3_Fine.0005.hdf5')
Output:
ans =
Filename: 'C:\Personal\Study software\Dropbox\Software\Matlab application\Confocal depth corre...'
Name: '/'
Groups: [1x1 struct]
Datasets: []
Datatypes: []
Links: []
Attributes: []
It looks empty, but when I use h5disp:
h5disp('L_600_3_Fine.0005.hdf5')
Output:
HDF5 L_600_3_Fine.0005.hdf5
Group '/'
Group '/2D Scan'
Attributes:
'VERSION': 2.000000
'TAG': 'S20'
'Header': '# 2-D Scan File created by LabVIEW Control Panel 6/9/2015 1:44:57 AM; Scan time 0 hrs 22 min 14 sec
#
# Beamline 20 ID
#
# User Comment:
#
#
# Amplifer Sensitivities:
# PreKB_I0: 10 nA/V I0: 5 nA/V IT: 1 nA/V CaliDiode: 200 pA/V
#
# Analog Input Voltages at start/end of scan:
# Preslit: 3.201/3.105 PreKB_I0: 0.229/0.120 I0: 0.100/-0.003 IT: 0.363/0.335 CaliDiode: 0.490/0.285
#
# XIA Filters:
# 1X: OUT 2X: OUT 4X: OUT 8X: OUT
#
# Filters on XIA Shutter Unit:
# 1X: OUT 2X: OUT
#
# Mono Info:
# Angle: 9.0304 degrees; Energy from motor record: 12599.997 eV; Energy from encoder: 4503.476 eV; 2nd Xtal: 111.5 mm
#
# ID Info:
# Gap Energy: 12750.0 eV; Offset: 150.0 eV; Harmonic: 1
#
# Slit Info:
# ID I0 slits: Center is at 250 (H), 0 (V) Size is 1000 wide x 4000 high
# IDB slits: Center is at 98 (H), -590 (V) Size is 680 wide x 880 high
# KB Slits: Center is at 0 (H), 450 (V) Size is 200 wide x 200 high
#
# Motor Positions:
# AeroTechH (20id:m61): -12788.033000 AeroTechV (20id:m62): 14909.005000 Fine-focus-Z (20id:m51): 100.512821 ADC KB focus (20id:m54): -700.000000
#
# Detector Names/PVs:
# Preslit/N/A PreKB_I0/N/A I0/N/A IT/N/A CaliDiode/N/A
# ICR Ch 1/N/A PKa_Sum/N/A SKa_Sum/N/A ClKa_Sum/N/A KKa_Sum/N/A
# CaKa_Sum/N/A TiKa_Sum/N/A MnKa_Sum/N/A FeKa_Sum/N/A NiKa_Sum/N/A
# CuKa_Sum/N/A ZnKa_Sum/N/A HgLa1_Sum/N/A AsKa_Sum/N/A SeKa_Sum/N/A
# Scatter_Sum/N/A
#
# X Positioner names/Drive PVs/Readback PVs:
# XPOS AeroTechH/20id:m61.VAL/20id:m61.RBV
#
# Y Positioner names/Drive PVs/Readback PVs:
# YPOS Fine-focus-Z/20id:m51.VAL/20id:m51.RBV
# Here is a readable list of column headings:
# 1) AeroTechH 11) ClKa_Sum 21) AsKa_Sum
# 2) Fine-focus-Z 12) KKa_Sum 22) SeKa_Sum
# 3) Preslit 13) CaKa_Sum 23) Scatter_Sum
# 4) PreKB_I0 14) TiKa_Sum
# 5) I0 15) MnKa_Sum
# 6) IT 16) FeKa_Sum
# 7) CaliDiode 17) NiKa_Sum
# 8) ICR Ch 1 18) CuKa_Sum
# 9) PKa_Sum 19) ZnKa_Sum
# 10) SKa_Sum 20) HgLa1_Sum
#
# Column Headings:
#AeroTechH Fine-focus-Z Preslit PreKB_I0 I0 IT CaliDiode ICR Ch 1 PKa_Sum SKa_Sum ClKa_Sum KKa_Sum CaKa_Sum TiKa_Sum MnKa_Sum FeKa_Sum NiKa_Sum CuKa_Sum ZnKa_Sum HgLa1_Sum AsKa_Sum SeKa_Sum Scatter_Sum
'
Dataset 'Detectors'
Size: 21x81x51
MaxSize: InfxInfxInf
Datatype: H5T_IEEE_F32BE (single)
ChunkSize: 21x81x1
Filters: none
FillValue: 0.000000
Attributes:
'Detector Names': 'Preslit', 'PreKB_I0', 'I0', 'IT', 'CaliDiode', 'ICR Ch 1', 'PKa_Sum', 'SKa_Sum', 'ClKa_Sum', 'KKa_Sum', 'CaKa_Sum', 'TiKa_Sum', 'MnKa_Sum', 'FeKa_Sum', 'NiKa_Sum', 'CuKa_Sum', 'ZnKa_Sum', 'HgLa1_Sum', 'AsKa_Sum', 'SeKa_Sum', 'Scatter_Sum'
'DATASET_TYPE': 'DETECTORS'
Dataset 'MCA 1'
Size: 1024x81x51
MaxSize: InfxInfxInf
Datatype: H5T_STD_U16BE (uint16)
ChunkSize: 1024x81x1
Filters: none
FillValue: 0
Attributes:
'DATASET_TYPE': 'MCA'
Dataset 'X Positions'
Size: 1x81x51
MaxSize: InfxInfxInf
Datatype: H5T_IEEE_F32BE (single)
ChunkSize: 1x81x51
Filters: none
FillValue: 0.000000
Attributes:
'Motor Info': 'AeroTechH', '20id:m61'
'DATASET_TYPE': 'X'
Dataset 'Y Positions'
Size: 51x1
MaxSize: 51x1
Datatype: H5T_IEEE_F32BE (single)
ChunkSize: []
Filters: none
FillValue: 0.000000
Attributes:
'DATASET_TYPE': 'Y'
'Motor Info': 'Fine-focus-Z', '20id:m51'
When I use HDFView to see the hdf5 file. I can see the data:
Please help me,
Thanks,
Peng
  2 commentaires
per isakson
per isakson le 21 Juil 2015
Modifié(e) : per isakson le 21 Juil 2015
Peng
Peng le 21 Juil 2015
Yes, I read them several times, but I still didn't find a clue. High-Level Functions, Easily view, read, and write HDF5 files Importing HDF5 Files

Connectez-vous pour commenter.

Réponse acceptée

per isakson
per isakson le 21 Juil 2015
Modifié(e) : per isakson le 13 Sep 2015
I recommend
  • Run some of the examples, which comes with the Matlab documentation.
  • Use HDFView to explore the structure of the data file. I prefer it to h5disp.
Here is a simple example with your file.
data = h5read( 'c:\m\cssm\L_600_3_Fine.0005\L_600_3_Fine.0005.hdf5' ...
, '/2D Scan/Detectors' );
>> whos
Name Size Bytes Class Attributes
data 21x81x51 347004 single
  1 commentaire
Peng
Peng le 21 Juil 2015
I really appreciate your help. I can read all the data now!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by