Skip to content
Snippets Groups Projects
Verified Commit cf0b0430 authored by Thomas Lambert's avatar Thomas Lambert :helicopter:
Browse files

refactor: make savetodat an util to reuse later

parent 25728e2f
No related branches found
No related tags found
No related merge requests found
function savecoordtodat(filename, header, x, y)
% SAVECOORDTODAT Saves the airfoil coordinates to a dat file
import af_tools.utils.vecttocol;
x = vecttocol(x);
y = vecttocol(y);
data=num2str([x, y],'%0.7f ');
contents=char(header,data);
dlmwrite(filename,contents,'delimiter','')
end
......@@ -73,7 +73,7 @@ narginchk(0,6);
% Import other functions from this package
import af_tools.nacacamber;
import af_tools.utils.parsenacainputs;
import af_tools.utils.*;
OPTION_LIST = {'spacing', 'zerote', 'savedat'};
......@@ -122,7 +122,9 @@ y = [yu, fliplr(yl(1:end-1))];
% Save coordinates to dat file
if savedat
savetodat(digits, x, y, spacing);
header = ['NACA',digits,' - ',spacing,' spacing'];
filename = ['naca', digits, '.dat'];
savecoordtodat(filename, header, x, y)
end
end
......@@ -155,14 +157,3 @@ zerote = p.Results.zerote;
savedat = p.Results.savedat;
end
function savetodat(digits, x, y, spacing)
% SAVETODAT Saves the airfoil coordinates to a dat file
header = ['NACA',digits,' (',spacing,' spacing)'];
data=num2str([x; y]');
contents=char(header,data);
fileName=['naca', digits, '.dat'];
dlmwrite(fileName,contents,'delimiter','')
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment