function [HvelsLeft, VvelsLeft, HvelsRight, VvelsRight] = make_model2() load 'centroids2_1.mat' Centroids; [HVL1 VVL1 HVR1 VVR1] = split_centroids(Centroids); [r l1] = size(HVL1); load 'centroids2_2.mat' Centroids; [HVL2 VVL2 HVR2 VVR2] = split_centroids(Centroids); [r l2] = size(HVL2); load 'centroids2_3.mat' Centroids; [HVL3 VVL3 HVR3 VVR3] = split_centroids(Centroids); [r l3] = size(HVL3); load 'centroids2_4.mat' Centroids; [HVL4 VVL4 HVR4 VVR4] = split_centroids(Centroids); [r l4] = size(HVL4); load 'centroids2_5.mat' Centroids; [HVL5 VVL5 HVR5 VVR5] = split_centroids(Centroids); [r l5] = size(HVL5); length = min([l1 ; l2; l3; l4; l5]); %make sure all same length HVL = [HVL1(1:length); HVL2(1:length); HVL3(1:length); HVL4(1:length); HVL5(1:length)]; VVL = [VVL1(1:length); VVL2(1:length); VVL3(1:length); VVL4(1:length); VVL5(1:length)]; HVR = [HVR1(1:length); HVR2(1:length); HVR3(1:length); HVR4(1:length); HVR5(1:length)]; VVR = [VVR1(1:length); VVR2(1:length); VVR3(1:length); VVR4(1:length); VVR5(1:length)]; HvelsLeft = average(HVL); VvelsLeft = average(VVL); HvelsRight = average(HVR); VvelsRight = average(VVR); function [Ave] = average(Matrix) % return average of columns [rows cols] = size(Matrix); Ave = sum(Matrix) / rows;