Discrete algorithm for low pass filter
You can probably use Matlab's filter command. If you call it like this:

[Y,Zf] = filter(B,A,X,Zi);


the variable Zf contains the state of the filter after filtering, and Zi contains the filter's state before filtering. You could proceed roughly like this (in pseudocode):

Acquire several samples and store them in vector Samples
[Y,Z] = filter(B,1,Samples); % assuming FIR filter stored in B
while 1
    acquire new sample and store it in Sample
    [Y,Z] = filter(B,1,Sample,Z);  % Y contains the updated filter output
end


To design the filter, I'd start by looking at the fir1 command.