function [ir, or] = regress(m,j)
%REGRESS 
%    
%    [IR, OR] = REGRESS(M,J) %
%    
%    See also: 
%    
%    

%MAN_PAGE_BEGIN
%
%   @purpose	
%
%   @synopsis	[ir, or] = regress(m,j)
%   @description  
%%
%   @see 
%
%MAN_PAGE_END

if (nargin < 2)|isempty(j),
	j = 1:get(m,'n_out');
end

dd = get(get(m,'data'),'contdata');

listlinks = get(m,'links');
listlinks = listlinks(j,:);

for i = unique(listlinks(:,1)),
	sub = find(listlinks(:,1) == i);
	
	ir{i} = dd(:,1:m.n_state + get(m,'n_in'));
	or{i} = dd(:,2*m.n_state+get(m,'n_in')+1:end);
	or{i} = or{i}(:,listlinks(sub,2));
end
