~ubuntu-branches/ubuntu/trusty/psychtoolbox-3/trusty-proposed

« back to all changes in this revision

Viewing changes to Psychtoolbox/PsychOneliners/log10nw.m

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2013-11-19 23:34:50 UTC
  • mfrom: (3.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20131119233450-f7nf92vb8qavjmk8
Tags: 3.0.11.20131017.dfsg1-3
Upload to unsable since fresh glew has arrived to sid!

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
function y=log10nw(x)
 
 
b'% y=log10nw(x)'
 
 
b'% "nw" stands for "No Warnings". Equivalent to Matlab\'s built-in LOG10 function, but suppresses warnings, '
 
 
b'% e.g. "Warning: Log of zero."'
 
 
b'%'
 
 
b'%   LOG10NW(X) is the base 10 logarithm of the elements of X.   '
 
 
b'%   Complex results are produced if X is negative.'
 
 
b'if nargin~=1'
 
 
b"\terror('Usage: y=log10nw(x)')"
 
 
b'end'
 
 
b'oldWarning=warning;'
 
 
b"warning('off');"
 
 
b'y = log(x) ./ log(10);'
 
 
b'warning(oldWarning);'
 
 
b'\t'
 
 
b'\\ No newline at end of file'
 
1
function y=log10nw(x)
 
2
% y=log10nw(x)
 
3
% "nw" stands for "No Warnings". Equivalent to Matlab's built-in LOG10 function, but suppresses warnings, 
 
4
% e.g. "Warning: Log of zero."
 
5
%
 
6
%   LOG10NW(X) is the base 10 logarithm of the elements of X.   
 
7
%   Complex results are produced if X is negative.
 
8
if nargin~=1
 
9
        error('Usage: y=log10nw(x)')
 
10
end
 
11
oldWarning=warning;
 
12
warning('off');
 
13
y = log(x) ./ log(10);
 
14
warning(oldWarning);
 
15