-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWriteFile.asv
More file actions
106 lines (89 loc) · 3.03 KB
/
WriteFile.asv
File metadata and controls
106 lines (89 loc) · 3.03 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
function WriteFile(object,sm)
fileID = fopen('output.txt','w');
% LU decomposition
% object.eqns = double(object.eqns);
% fprintf(fileID,'Equations \r\n');
% for ii = 1:size(object.eqns,1)
% fprintf(fileID,'%s\t',object.eqns(ii,:));
% fprintf(fileID,'\r\n');
% end
if sm == 1
object.ans = double(object.ans);
fprintf(fileID,'Roots \r\n');
for ii = 1:size(object.ans,1)
fprintf(fileID,'%g\t',object.ans(ii,:));
fprintf(fileID,'\r\n');
end
% fprintf(fileID,'%s \r\n',object.eqns(1:2));
object.L = double(object.L);
fprintf(fileID,'\r\n');
fprintf(fileID,'Lower matrix \r\n');
for ii = 1:size(object.L,1)
fprintf(fileID,'%g\t',object.L(ii,:));
fprintf(fileID,'\r\n');
end
object.U = double(object.U);
fprintf(fileID,'\r\n');
fprintf(fileID,'Upper matrix \r\n');
for ii = 1:size(object.U,1)
fprintf(fileID,'%f\t',object.U(ii,:));
fprintf(fileID,'\r\n');
end
end
%x+y-2 x-y-4
if sm == 2
object.roots = double(object.roots);
fprintf(fileID,'Roots \r\n');
for ii = 1:size(object.roots,1)
fprintf(fileID,'%g\t',object.roots(ii,:));
fprintf(fileID,'\r\n');
end
object.data = double(object.data);
fprintf(fileID,'Iterations \r\n');
for ii = 1:size(object.data,1)
fprintf(fileID,'%12e\t',object.data(ii,:));
fprintf(fileID,'\r\n');
end
fprintf(fileID,'Time: \r\n');
fprintf(fileID,'%f\t',object.ExTime);
fprintf(fileID,'\r\n');
fprintf(fileID,'precession: \r\n');
fprintf(fileID,'%f\t',object.precession);
fprintf(fileID,'\r\n');
end
if sm == 3
object.x = double(object.x);
fprintf(fileID,'Roots \r\n');
for ii = 1:size(object.x,1)
fprintf(fileID,'%g\t',object.x(ii,:));
fprintf(fileID,'\r\n');
end
object.a = double(object.a);
fprintf(fileID,'Coefficient \r\n');
for ii = 1:size(object.a,1)
fprintf(fileID,'%g\t',object.a(ii,:));
fprintf(fileID,'\r\n');
end
object.b = double(object.b);
fprintf(fileID,'Conistants \r\n');
for ii = 1:size(object.b,1)
fprintf(fileID,'%g\t',object.b(ii,:));
fprintf(fileID,'\r\n');
end
end
if sm == 4
object.b = double(object.b);
fprintf(fileID,'Roots \r\n');
for ii = 1:size(object.b,1)
fprintf(fileID,'%g\t',object.b(ii,:));
fprintf(fileID,'\r\n');
end
object.a = double(object.a);
fprintf(fileID,'Coefficient \r\n');
for ii = 1:size(object.a,1)
fprintf(fileID,'%g\t',object.a(ii,:));
fprintf(fileID,'\r\n');
end
end
fclose(fileID);
end