%% parse_polar.m % Read polar file and output required variables. If CLMax is not reached, % output empty variables. function [alfa,cl,cd,cm] = parse_polar(fname) output = [0 0 0 0 0 0 0]; n = 0; try outid = fopen(['complete\',fname]); while 1 n = n+1; outline = fgetl(outid); if ~ischar(outline), break, end if n>12 output(n-12,:) = str2num(outline); end end alfa = output(:,1); cl = output(:,2); cd = output(:,4); cm = output(:,5); fclose(outid); catch alfa = [];cl = []; cd = [];cm = []; fclose('all'); return end cmax = max(cl); if ~(cmax>cl(length(cl))) alfa = []; cl = []; cd = [];cm = []; return end