summaryrefslogtreecommitdiff
path: root/macros/wrev.sci
diff options
context:
space:
mode:
authorSunil Shetye2018-07-25 17:32:17 +0530
committerSunil Shetye2018-07-26 23:50:17 +0530
commitcdd55940b7a287810e423017c42e7c965815c468 (patch)
treed802563d2d507039354a3cf48e75465b7e7a8d76 /macros/wrev.sci
parent1251f70aa3442736ce6fd9c4fb7fbce412af5a52 (diff)
downloadFOSSEE-Signal-Processing-Toolbox-cdd55940b7a287810e423017c42e7c965815c468.tar.gz
FOSSEE-Signal-Processing-Toolbox-cdd55940b7a287810e423017c42e7c965815c468.tar.bz2
FOSSEE-Signal-Processing-Toolbox-cdd55940b7a287810e423017c42e7c965815c468.zip
code changes by Shashikiran Yadalam during FOSSEE Fellowship 2018
Diffstat (limited to 'macros/wrev.sci')
-rw-r--r--macros/wrev.sci34
1 files changed, 27 insertions, 7 deletions
diff --git a/macros/wrev.sci b/macros/wrev.sci
index a01ed77..343b24c 100644
--- a/macros/wrev.sci
+++ b/macros/wrev.sci
@@ -1,12 +1,25 @@
-function [y]= wrev(x)
+// Copyright (C) 2018 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author:[insert name]
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
-// Reverses order of elements of input vector
+
+function y = wrev(x)
+
+
+ // Reverses order of elements of input vector
// Calling Sequence
// [y]=wrev(x)
// Parameters
// x: Input vector of string, real or complex values
// Description
-// This is an Octave function.
+// This is an Octave function which is built in scilab.
// This function reverses the order of elements of the input vector x.
// Examples
// 1. wrev([1 2 3])
@@ -15,9 +28,16 @@ function [y]= wrev(x)
// ans= cba
funcprot(0);
-rhs=argn(2);
-if (rhs~=1) then
- error("Wrong number of input arguments.")
-else y=callOctave("wrev",x)
+ if (argn(2)< 1| argn(2) > 1) then
+ error("wrong number of input arguments"); //number of input arguments has to be 1
+ end
+ if(~isvector(x))//checks whether input is a vector
+ error('x must be a vector');
+ end
+ if(type(x)==10 | type(x)==1) then
+ //revers the vector
+ l = size(x,"c");
+ k = 0:l-1;
+ y = x(l-k);
end
endfunction