function [airfoil_update] = splitAirfoil(airfoil)
airfoil_update=array2table(zeros(0,4),'VariableNames',{'AeroDataId','X_C','CP','Upper'});
DataId_unique=unique(airfoil.AeroDataId);
for i=1:1:size(DataId_unique)
disp(DataId_unique(i,:));
AeroDataId=airfoil(airfoil.AeroDataId==DataId_unique(i,:),:);
[~, min_idx]=min(AeroDataId.X_C);
airfoil_new=AeroDataId(1:min_idx,:);
airfoil_new.Upper(:,:)=0;
airfoil_update=[airfoil_update; airfoil_new];
airfoil_new=AeroDataId(min_idx+1:end,:);
airfoil_new.Upper(:,:)=1;
airfoil_update=[airfoil_update; airfoil_new];
end
end
4 Comments
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/499485-how-can-i-speed-up-my-function#comment_784241
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/499485-how-can-i-speed-up-my-function#comment_784241
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/499485-how-can-i-speed-up-my-function#comment_784248
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/499485-how-can-i-speed-up-my-function#comment_784248
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/499485-how-can-i-speed-up-my-function#comment_784519
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/499485-how-can-i-speed-up-my-function#comment_784519
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/499485-how-can-i-speed-up-my-function#comment_784520
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/499485-how-can-i-speed-up-my-function#comment_784520
Sign in to comment.