function layout=cosmo_meeg_read_layout(fn)
% Read FieldTrip layout
%
% layout=cosmo_meeg_read_layout(fn)
%
% Inputs:
% fn Filename of layout file, or a string containing the
% layout. In the latter case fn must contain at least
% one newline ('\n') character.
% A layout file is a text file with one line per
% sensor, with each line containing the following
% data separated by white-space:
% 1) sensor number (integer)
% 2) horizontal position (float)
% 3) vertical position (float)
% 4) width (float)
% 5) height (float)
% 6) label (string)
%
% Output:
% layout struct with fields containing data for N sensors:
% .pos Nx2 matrix with x and y position
% .width Nx1 vector
% .height Nx1 vector
% .label Nx1 cell string with channel labels
%
% Notes:
% - whitespace is trimmed from the labels
% - the sensor number is not used; the order of the sensors in layout is
% the same as in the layout file
%
% # For CoSMoMVPA's copyright information and license terms, #
% # see the COPYING file distributed with CoSMoMVPA. #