From 4dab50a3f1d3edacae9005bd9fabe744ca9d4919 Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Thu, 3 Feb 2011 10:41:52 +0100 Subject: [PATCH] matlab: enable non comlex FD dump to read todo: the matlab function should use the number of frequencies in the hdf5 file in the future --- matlab/ReadHDF5FieldData.m | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/matlab/ReadHDF5FieldData.m b/matlab/ReadHDF5FieldData.m index 50136e9..dab3ab2 100644 --- a/matlab/ReadHDF5FieldData.m +++ b/matlab/ReadHDF5FieldData.m @@ -61,15 +61,21 @@ if (numel(TD.names)>0) end if (numel(FD.names)>0) - Nr_freq = numel(FD.names)/2; + Nr_freq = numel(FD.names) for n=1:Nr_freq name = ['/FieldData/FD/f' int2str(n-1) '_real']; ind = find(strcmp(FD.names,name)); - hdf_fielddata.FD.values{n} = double(hdf5read(file,FD.names{ind})); - hdf_fielddata.FD.freq(n) = FD.freq(ind); - name = ['/FieldData/FD/f' int2str(n-1) '_imag']; - ind = find(strcmp(FD.names,name)); - hdf_fielddata.FD.values{n} = hdf_fielddata.FD.values{n} + 1j*double(hdf5read(file,FD.names{ind})); + if isempty(ind) + ind = find(strcmp(FD.names,['/FieldData/FD/f' int2str(n-1)])); + hdf_fielddata.FD.values{n} = double(hdf5read(file,FD.names{ind})); + hdf_fielddata.FD.freq(n) = FD.freq(ind); + else + hdf_fielddata.FD.values{n} = double(hdf5read(file,FD.names{ind})); + hdf_fielddata.FD.freq(n) = FD.freq(ind); + name = ['/FieldData/FD/f' int2str(n-1) '_imag']; + ind = find(strcmp(FD.names,name)); + hdf_fielddata.FD.values{n} = hdf_fielddata.FD.values{n} + 1j*double(hdf5read(file,FD.names{ind})); + end end end