function [linearlength] = linearplot(coord,inperm)

% LINEARPLOT plots the object set using the ordered coordinates in COORD
% and labels the positions by the order of the objects given in INPERM.
%
% syntax: [linearlength] = linearplot(coord,inperm)
%
% The output value LINEARLENGTH is the sum of the interpoint distances from
% COORD.

n = length(coord);

linearlength = 0;

for i = 1:(n-1)
    
    linearlength = linearlength + abs(coord(i) - coord(i+1));
end

ylim([-(1/2)*linearlength,(1/2)*linearlength]);

plot(coord,zeros(n,1),'k.')

hold on

for i = 1:n
    objectlabels{i,1} = int2str(inperm(i));
end


text(coord,zeros(n,1),objectlabels,'fontsize',10,'verticalalignment','bottom')
