-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotfile.m
More file actions
33 lines (29 loc) · 820 Bytes
/
plotfile.m
File metadata and controls
33 lines (29 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function plotfile(fname, fext, Nx, Ny, plt_title, plt_order, Nparts)
data = zeros(Ny, Nx);
pos = 0;
for p=0:Nparts-1
fil = fopen(strcat(fname, int2str(p), fext), 'rb');
pdata = fread(fil, 'double');
fclose(fil);
ysz = length(pdata) / Nx;
pdata = reshape(pdata, Nx, ysz);
pdata = transpose(pdata);
ycp = ysz - 2;
ysh = 1;
if p == 0
ycp = ycp + 1;
ysh = 0;
end
if p == Nparts - 1
ycp = ycp + 1;
end
data(pos + 1:pos + ycp, :) = pdata(ysh + 1:ysh + ycp, :);
pos = pos + ycp;
end
subplot(plt_order(1), plt_order(2), plt_order(3))
imagesc(data)
colorbar
title(plt_title)
axis image
set(gca, 'FontSize', 10, 'fontWeight', 'bold')
end