annotate scripts/general/flipud.m @ 27898:4d6d21839dfd

remove Author: jwe and Adapted-by: jwe lines from source files These lines have little meaning now in the age of modern version control systems. Files affected: url-transfer.cc, url-transfer.h, acot.m, acoth.m, acsc.m, acsch.m, asec.m, asech.m, cot.m, coth.m, csc.m, csch.m, sec.m, sech.m, cart2pol.m, cart2sph.m, deal.m, fliplr.m, flipud.m, int2str.m, logspace.m, num2str.m, pol2cart.m, rot90.m, sortrows.m, sph2cart.m, waitbar.m, doc.m, hsv2rgb.m, rgb2hsv.m, beep.m, isstr.m, setstr.m, strmatch.m, cond.m, rank.m, trace.m, bug_report.m, cast.m, delete.m, dir.m, list_primes.m, ls.m, ls_command.m, menu.m, pack.m, recycle.m, substruct.m, version.m, glpk.m, axis.m, box.m, grid.m, __axis_label__.m, text.m, title.m, view.m, xlabel.m, ylabel.m, zlabel.m, bar.m, barh.m, comet3.m, hist.m, line.m, loglog.m, mesh.m, patch.m, plot.m, polar.m, __bar__.m, __line__.m, __plt__.m, __stem__.m, semilogx.m, semilogy.m, sombrero.m, stairs.m, stem.m, surface.m, __default_plot_options__.m, __gnuplot_drawnow__.m, __next_line_color__.m, __plt_get_axis_arg__.m, __pltopt__.m, clf.m, closereq.m, gca.m, gnuplot_binary.in.m, isfigure.m, meshgrid.m, __gnuplot_draw_axes__.m, __gnuplot_draw_figure__.m, shg.m, addpref.m, getpref.m, ispref.m, loadprefs.m, prefsfile.m, saveprefs.m, rmpref.m, setpref.m, ismember.m, setdiff.m, union.m, hankel.m, hilb.m, vander.m, median.m, std.m, cstrcat.m, isletter.m, str2num.m, strcat.m, oruntests.m, rundemos.m, asctime.m, clock.m, ctime.m, date.m, etime.m, is_leap_year.m.
author John W. Eaton <jwe@octave.org>
date Thu, 02 Jan 2020 15:43:01 -0500
parents 00f796120a6d
children b442ec6dda5c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26376
00f796120a6d maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
1 ## Copyright (C) 1993-2019 John W. Eaton
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
2 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
3 ## This file is part of Octave.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
4 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
5 ## Octave is free software: you can redistribute it and/or modify it
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
6 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
7 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
8 ## (at your option) any later version.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
9 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
13 ## GNU General Public License for more details.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
14 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6046
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
17 ## <https://www.gnu.org/licenses/>.
245
16a24e76d6e0 [project @ 1993-12-03 02:00:15 by jwe]
jwe
parents: 4
diff changeset
18
3369
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
19 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20158
diff changeset
20 ## @deftypefn {} {} flipud (@var{x})
19126
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
21 ## Flip array upside down.
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
22 ##
20158
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
23 ## Return a copy of @var{x} with the order of the rows reversed. In other
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
24 ## words, @var{x} is flipped upside-down about a horizontal axis. For example:
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3420
diff changeset
25 ##
3369
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
26 ## @example
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
27 ## @group
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
28 ## flipud ([1, 2; 3, 4])
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
29 ## @result{} 3 4
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
30 ## 1 2
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
31 ## @end group
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
32 ## @end example
4869
b92d59213e63 [project @ 2004-04-21 17:03:02 by jwe]
jwe
parents: 3426
diff changeset
33 ##
19154
76baa2d10abb flip.m: Add input validation test.
Rik <rik@octave.org>
parents: 19126
diff changeset
34 ## @seealso{fliplr, flip, rot90, rotdim}
3369
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
35 ## @end deftypefn
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
36
2311
2b5788792cad [project @ 1996-07-11 20:18:38 by jwe]
jwe
parents: 2303
diff changeset
37 function y = flipud (x)
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
38
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
39 if (nargin != 1)
6046
34f96dd5441b [project @ 2006-10-10 16:10:25 by jwe]
jwe
parents: 5642
diff changeset
40 print_usage ();
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
41 endif
19126
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
42 y = flip (x, 1);
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
43
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
44 endfunction
7411
83a8781b529d [project @ 2008-01-22 21:52:25 by jwe]
jwe
parents: 7017
diff changeset
45
83a8781b529d [project @ 2008-01-22 21:52:25 by jwe]
jwe
parents: 7017
diff changeset
46
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
47 %!assert (flipud ([1, 2; 3, 4]), [3, 4; 1, 2])
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
48 %!assert (flipud ([1, 2; 3, 4; 5, 6]), [5, 6; 3, 4; 1, 2])
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
49 %!assert (flipud ([1, 2, 3; 4, 5, 6]), [4, 5, 6; 1, 2, 3])
19126
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
50 %!assert (flipud ([1 2 3]), [1 2 3])
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
51
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
52 ## Test NDArrays
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
53 %!test
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
54 %! a(:,:,1) = [ 1 2 3; 4 5 6];
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
55 %! a(:,:,2) = [ 7 8 9; 10 11 12];
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
56 %! b(:,:,1) = [ 4 5 6; 1 2 3];
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
57 %! b(:,:,2) = [10 11 12; 7 8 9];
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 20852
diff changeset
58 %! assert (flipud (a), b);
19126
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
59
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
60 ## Test NDArray with singleton dimensions
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
61 %!test
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
62 %! a(:,:,:,1) = [ 1 2 3; 4 5 6];
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
63 %! a(:,:,:,2) = [ 7 8 9; 10 11 12];
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
64 %! b(:,:,:,1) = [ 4 5 6; 1 2 3];
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
65 %! b(:,:,:,2) = [10 11 12; 7 8 9];
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 20852
diff changeset
66 %! assert (flipud (a), b);
19126
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
67
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
68 ## Test for 1 row, i.e., returns the same
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
69 %!test
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
70 %! a(1,:,:,1) = [ 1 2 3 4];
995df67fc912 Flip arrays - ND support for fliplr and flipud, and replace flipdim with flip.
Carnë Draug <carandraug+dev@gmail.com>
parents: 17744
diff changeset
71 %! a(1,:,:,2) = [ 5 6 7 8];
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 20852
diff changeset
72 %! assert (flipud (a), a);
7411
83a8781b529d [project @ 2008-01-22 21:52:25 by jwe]
jwe
parents: 7017
diff changeset
73
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
74 %!error flipud ()
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
75 %!error flipud (1, 2)