blob: 343b24ca134c11d468c0a1ce393b8b91070a5454 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// 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
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 which is built in scilab.
// This function reverses the order of elements of the input vector x.
// Examples
// 1. wrev([1 2 3])
// ans= 3 2 1
// 2. wrev(['a','b','c'])
// ans= cba
funcprot(0);
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
|