Ignore:
Timestamp:
02/09/11 11:32:42 (14 years ago)
Author:
jschierm
Message:

Utility updates made for LIMS project.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/utils/Array/allequal.m

    r33 r7397  
    11%
    22%  function to return an empty array if all array elements are
    3 %  equal to the given value.
     3%  equal to the given value, which may also be empty but not nan.
     4%
     5%  (note that by definition, nan is not equal to nan.  this could
     6%  be changed by using isequalwithequalnans.)
    47%
    58%  function [aout]=allequal(ain,aval)
     
    1619if     islogical(ain) && islogical(aval)
    1720    for i=1:numel(ain)
    18         if ain(i) ~= aval
     21        if ~isequal(ain(i),aval)
    1922            return
    2023        end
     
    2427elseif isnumeric(ain) && isnumeric(aval)
    2528    for i=1:numel(ain)
    26         if ain(i) ~= aval
     29        if ~isequal(ain(i),aval)
    2730            return
    2831        end
     
    4144    if     islogical(aval)
    4245        for i=1:numel(ain)
    43             if ~islogical(ain{i}) || ain{i} ~= aval
     46            if ~islogical(ain{i}) || ~isequal(ain{i},aval)
    4447                return
    4548            end
     
    4952    elseif isnumeric(aval)
    5053        for i=1:numel(ain)
    51             if ~isnumeric(ain{i}) || ain{i} ~= aval
     54            if ~isnumeric(ain{i}) || ~isequal(ain{i},aval)
    5255                return
    5356            end
Note: See TracChangeset for help on using the changeset viewer.