1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) INRIA - Farid BELAHCENE
3 // Copyright (C) DIGITEO - 2011 - Allan CORNET
4 // Copyright (C) 2013 - Samuel GOUGEON : restriction to decimal numbers removed
6 // This file must be used under the terms of the CeCILL.
7 // This source file is licensed as described in the file COPYING, which
8 // you should have received as part of this distribution. The terms
9 // are also available at
10 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
12 function y = flipdim(x, dim)
15 // Given x, a scalar/vector/matrix of any type and an integer dim, this function flips the x components along the dimension number dim (x and y have the same size).
17 // x : a scalar/vector/array
18 // dim : a positive integer
20 // y : a scalar/vector/array
26 msg = _("%s: Wrong number of input argument(s): %d expected.\n");
27 error(msprintf(msg, "flipdim", 2));
30 if size(dim, "*") <> 1 then
31 msg = _("%s: Wrong size for input argument #%d: A positive integer expected.\n")
32 error(msprintf(msg, "flipdim", 2));
33 elseif type(dim) <> 8 & (type(dim) <> 1 | dim < 1 ) then
34 msg = _("%s: Wrong type for input argument #%d: A positive integer expected.\n");
35 error(msprintf(msg, "flipdim", 2));
50 for k = dim + 1:ndims(x)