-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathread_node_coordinates_zbc.m
55 lines (40 loc) · 1.25 KB
/
read_node_coordinates_zbc.m
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
function [nnodes, nodecoord] = read_node_coordinates_zbc(path_of_analysis)
% PERFORM 3D Binary Files Reader
% by Baris Erkus
%
% Please read the license before use.
%
% ver 0.01
% Basic reading
% 2.1 Node Coordinates
% File name = ZBC
% File type = binary direct access. Record length = 24 bytes
% One control record, plus one record for each node.
% Control record :
% No. of nodes (integer*4).
% Rest not used.
% Record for each node :
% H1 coordinate (real*8).
% H2 coordinate (real*8).
% V coordinate (real*8).
% Given the coordinates of a node, search this file to obtain the node
% number.
file_name = 'ZBC';
file_path = [path_of_analysis, '\', file_name];
fileID = fopen(file_path);
for i=1:1
%Control Record
nnodes = fread(fileID, [1,1], 'integer*4'); %Number of nodes
%temp readings
temp(i,1) = fread(fileID, [1,1], 'integer*4')'; %temp reading
temp(i,1) = fread(fileID, [1,1], 'real*8')'; %temp reading
temp(i,1) = fread(fileID, [1,1], 'real*8')'; %temp reading
end
nodecoord = zeros(nnodes,3);
for i=1:nnodes
nodecoord(i,1) = fread(fileID, [1,1], 'real*8')'; %H1
nodecoord(i,2) = fread(fileID, [1,1], 'real*8')'; %H2
nodecoord(i,3) = fread(fileID, [1,1], 'real*8')'; %Vert
end
fclose(fileID);
end