The following protocol calculated flow rate in the microfluidic channels using data obtained from PIV using the rectangular channel flow equations.

```%Calculates flow rate from velocity according to the exact solution of
%rectangular channel flow
%Enter everything as u:m/s, W,H: micron, L: mm
function[q]=profilecalc(W,H,L)
%Definitions, converting to standard SI
%Width
w=W*10ˆ-6;
%Height
h=H*10ˆ-6;
%Length
l=L*10ˆ-3;
%Viscosity
mu=8.9*10ˆ-4;
%Aspect ratio
a=h/w;
%Velocity
u=zeros;
sum=0;
term=0;
%Define time step (us)
time step=55;
%For each time step/file:
%Access the x-component of velocity data, vx and find the maximum velocity
%Average the velocity data along each column to represent a global average
%for the divided pixel down the image window. Store in an array
maximum velocity=zeros(1,numel(v));

for i = 1 : numel(v)
%Average each column and store in a row each
average velocity along y=mean(v(i).vx,1);
%account for negatives (oscillatory flow)
avg=mean(average velocity along y);
if avg¿0
maximum velocity(i)=max(average velocity along y);
else
maximum velocity(i)=min(average velocity along y);
end
end
%Before Mark’s oscillatory/pulsatile flow changes
%
for i = 1 : numel(v)
%Average each column and store in a row each
average velocity along y=mean(v(i).vx,1);
%Maximum velocity
maximum velocity(i)=max(average velocity along y);
end
%
%Comes out currently in units of pixels
%Multiply by pixel to micron scaling factor for 10x magnification lens.
%Number of microns/pixels
pixel to micron=550/839.75;
%So now in units of microns
maximum velocity=maximum velocity*pixel to micron;
%Convert to m
maximum velocity=maximum velocity*10ˆ-6;

%Divide by time step to get velocity in m/s
maximum velocity=maximum velocity/(time step*10ˆ-6);
u=maximum velocity;
%Calculate the bracketed term in the flow rate equation
for m=1:2:19
t=((192*a)/(m*pi)ˆ5)*tanh((m*pi)/(2*a));
term=term+t;
end
Tterm=1-term;
%Calculate the sum term in the velocity expression, assuming we are using
%maximum velocities from PIV analysis at mid-channel, with z=h/2 and y=0.
%We here assume that we correctly found the correct z-plane while scanning
%with microscope, and the PIV analysis uses a maximum velocity value in
%middle of channel but this is theoretically the case
for k=1:2:19
s=(1/kˆ3)*(1-(1/(cosh(k*pi*w/(2*h)))))*sind(k*180/2);
sum=sum+s;
end
Hterm=sum;
%Now find the flow rate in mˆ3/s
q=(u*piˆ3*Tterm*w*h)/(48*Hterm);
%Convert to ml/min
q=q*1000*1000*60;
q=q’;

```