Change HDF5 file attribute from 'dx,dy,dz' to 'dx_dy_dz'

这个提交包含在:
Craig Warren
2018-05-23 17:43:07 +01:00
父节点 38d51fc187
当前提交 b3247b07dc
共有 8 个文件被更改,包括 24 次插入28 次删除

查看文件

@@ -11,17 +11,17 @@ fullfilename = strcat(pathname, filename);
if filename ~= 0
header.title = h5readatt(fullfilename, '/', 'Title');
header.iterations = double(h5readatt(fullfilename,'/', 'Iterations'));
tmp = h5readatt(fullfilename, '/', 'dx, dy, dz');
tmp = h5readatt(fullfilename, '/', 'dx_dy_dz');
header.dx = tmp(1);
header.dy = tmp(2);
header.dz = tmp(3);
header.dt = h5readatt(fullfilename, '/', 'dt');
header.nsrc = h5readatt(fullfilename, '/', 'nsrc');
header.nrx = h5readatt(fullfilename, '/', 'nrx');
% Time vector for plotting
time = linspace(0, (header.iterations)*(header.dt), header.iterations)';
% Initialise structure for field arrays
fields.ex = zeros(header.iterations, header.nrx);
fields.ey = zeros(header.iterations, header.nrx);
@@ -29,7 +29,7 @@ if filename ~= 0
fields.hx = zeros(header.iterations, header.nrx);
fields.hy = zeros(header.iterations, header.nrx);
fields.hz = zeros(header.iterations, header.nrx);
% Save and plot fields from each receiver
for n=1:header.nrx
path = strcat('/rxs/rx', num2str(n));
@@ -44,7 +44,7 @@ if filename ~= 0
fields.hx(:,n) = h5read(fullfilename, strcat(path, 'Hx'));
fields.hy(:,n) = h5read(fullfilename, strcat(path, 'Hy'));
fields.hz(:,n) = h5read(fullfilename, strcat(path, 'Hz'));
fh1=figure('Name', strcat('rx', num2str(n)));
ax(1) = subplot(3,2,1); plot(time, fields.ex(:,n), 'r', 'LineWidth', 2), grid on, xlabel('Time [s]'), ylabel('Field strength [V/m]'), title('E_x')
ax(2) = subplot(3,2,3); plot(time, fields.ey(:,n), 'r', 'LineWidth', 2), grid on, xlabel('Time [s]'), ylabel('Field strength [V/m]'), title('E_y')
@@ -53,7 +53,7 @@ if filename ~= 0
ax(5) = subplot(3,2,4); plot(time, fields.hy(:,n), 'b', 'LineWidth', 2), grid on, xlabel('Time [s]'), ylabel('Field strength [A/m]'), title('H_y')
ax(6) = subplot(3,2,6); plot(time, fields.hz(:,n), 'b', 'LineWidth', 2), grid on, xlabel('Time [s]'), ylabel('Field strength [A/m]'), title('H_z')
set(ax,'FontSize', 16, 'xlim', [0 time(end)]);
% Options to create a nice looking figure for display and printing
set(fh1,'Color','white','Menubar','none');
X = 60; % Paper size
@@ -62,11 +62,11 @@ if filename ~= 0
yMargin = 0; % Bottom/top margins from page borders
xSize = X - 2*xMargin; % Figure size on paper (width & height)
ySize = Y - 2*yMargin; % Figure size on paper (width & height)
% Figure size displayed on screen
set(fh1, 'Units','centimeters', 'Position', [0 0 xSize ySize])
movegui(fh1, 'center')
% Figure size printed on paper
set(fh1,'PaperUnits', 'centimeters')
set(fh1,'PaperSize', [X Y])