Changeset 7397


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

Utility updates made for LIMS project.

Location:
issm/trunk/src/m/utils/Array
Files:
2 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
  • issm/trunk/src/m/utils/Array/rotateticklabel.m

    r3093 r7397  
    5151c=get(h,'YTick');
    5252%make new tick labels
    53 if rot<180
    54     th=text(b,repmat(c(1)-.1*(c(2)-c(1)),length(b),1),a,'HorizontalAlignment','right','rotation',rot,'Interpreter','none');
    55 else
    56     th=text(b,repmat(c(1)-.1*(c(2)-c(1)),length(b),1),a,'HorizontalAlignment','left','rotation',rot,'Interpreter','none');
     53%  must consider yscale (jes, 9/14/10)
     54switch lower(get(h,'YScale'))
     55    case 'linear'
     56        if rot<180
     57            th=text(b,repmat(c(1)-.1*(c(2)-c(1)),length(b),1),a,'HorizontalAlignment','right','rotation',rot,'Interpreter','none');
     58        else
     59            th=text(b,repmat(c(1)-.1*(c(2)-c(1)),length(b),1),a,'HorizontalAlignment','left','rotation',rot,'Interpreter','none');
     60        end
     61    case 'log'
     62        if rot<180
     63            th=text(b,repmat(10^(log10(c(1))-.1*(log10(c(2))-log10(c(1)))),length(b),1),a,'HorizontalAlignment','right','rotation',rot,'Interpreter','none');
     64        else
     65            th=text(b,repmat(10^(log10(c(1))-.1*(log10(c(2))-log10(c(1)))),length(b),1),a,'HorizontalAlignment','left','rotation',rot,'Interpreter','none');
     66        end
     67    otherwise
     68        set(h,'XTickLabel',a);
    5769end
    58 
    59 end
Note: See TracChangeset for help on using the changeset viewer.