Code covered by the BSD License  

Highlights from
CTMSIM - an interactive freeway traffic macrosimulator

image thumbnail
from CTMSIM - an interactive freeway traffic macrosimulator by Alex Kurzhanskiy
Freeway traffic simulation based on Asymmetric Cell Transmission Model

get_cell_lengths(celldata)
function cl = get_cell_lengths(celldata)
% GET_CELL_LENGTHS - extract cell lengths from the array
%                    of freeway cell data structures.
%
% Call:   cl = get_cell_lengths(celldata)
%
% Parameter:   celldata - array of freeway cell data structures.
%
% Returns:   cl - vector of cell lengths.
%
% Last modified:   10/14/2006.

%
% Alex Kurzhanskiy   <akurzhan@eecs.berkeley.edu>
%

N  = size(celldata, 2);  % number of cells

cl = [];

for i = 1:N
  cl = [cl; abs(celldata(i).PMend - celldata(i).PMstart)];
end

return;

Contact us at files@mathworks.com