-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreadFile.m
More file actions
24 lines (16 loc) · 955 Bytes
/
readFile.m
File metadata and controls
24 lines (16 loc) · 955 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
%Takes .xml file generated by fcal and finds the image to probe transform
%Input: path to .xml file
%Output: Image-To-Probe transform
function[matrix] = readFile(filePath)
%open .xml file and rewrite it to a .txt file
reWrite = 'outputXML.txt';
file = xmlread(filePath, 'rt');
xmlwrite(reWrite, file);
%open newly generated .txt file
file = fopen(reWrite);
%Read in transform from .txt file
transform = textscan(file, '<Transform Date="%f_%f" Error="%f" From="Image" Matrix="%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f', 'headerLines', 49);
%generate a 4x4 matrix of the image to probe transform
matrix = [transform{4}(1),transform{5}(1), transform{6}(1),transform{7}(1);transform{8}(1),transform{9}(1),transform{10}(1),transform{11}(1);transform{12}(1),transform{13}(1),transform{14}(1), transform{15}(1);transform{16}(1), transform{17}(1), transform{18}(1), transform{19}(1)];
fclose(file);
end