Advertisement
x89codered89x

celleq.m for MATLAB

Apr 3rd, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.48 KB | None | 0 0
  1. % MATLAB COMPARE N-dimensional CELL array elements with one other element
  2.  
  3. function cellsEq = celleq(cels,rhs)
  4.     s = size(cels);
  5.     cels = reshape(cels,[],1);
  6.     cellsEq = cell(size(prod(s),1));
  7.    
  8.     for i = 1:prod(s)
  9.        cellsEq{i} = strcmp(cels{i},rhs);
  10.     end
  11.     cellsEq = reshape(cellsEq,s);
  12. end
  13.  
  14. % EDIT: Found a much more complete version: http://www.mathworks.com/matlabcentral/fileexchange/27542-compare-nested-cell---struct-arrays-recursively/content/celleq.m
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement