function [out] = randomize(x) % This function will perform a randomization of a multi-dimensional cell % for one iteration. If more iterations are desired, call this function % in a do loop. % % DESCRIPTION: % Perform a randomization of cell x for 1 iteration. % % INPUT VARIABLES: % x - This should be a cell parameter containing matrices of equal size. % % OUTPUT VARIABLES: % out - resultant randomized x % % By: Stephen W. Bieda, III % Coded on: 09/17/2007 % E-mail: bieda@atmo.arizona.edu for i = 1:length(x); n = max(length(x{i})); end a = randperm(n); b = size(x); out = cell(size(x)); for i = 1:n; for j = 1:b(1); for k = 1:b(2); for l = 1:n; switch a(i); case l out{j,k}(i,:) = x{j,k}(l,:); end end end end end return