Code covered by the BSD License  

Highlights from
Union of several arrays

Be the first to rate this file! 18 Downloads (last 30 days) File Size: 1.14 KB File ID: #24834

Union of several arrays

by

 

Uses matlab union function recursively to create the union of several arrays

| Watch this File

File Information
Description

function [varargout] = union_several (varargin)
% function [varargout] = union_several (varargin)
% varargout{1} is the union vector
% varargout{i>1} are the indices of the various varargin (in their order)

numarr = length(varargin);
union_arr = varargin{1};
for i=1:numarr
        union_arr= union(union_arr,varargin{i});
end
varargout{1} = union_arr;
for i=1:numarr
        [union_arr, temp,varargout{i+1}]= union(union_arr,varargin{i});
end
        

MATLAB release MATLAB 7.7 (R2008b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.

Contact us