From: Ben Pfaff Date: Mon, 25 Oct 2021 16:57:08 +0000 (-0700) Subject: Add an example for MATRIX PRINT. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f545a607f58d17d8c55736cc231bd9ec32b9062;p=pspp Add an example for MATRIX PRINT. --- diff --git a/doc/automake.mk b/doc/automake.mk index cb277a2e88..6d2e6ebcc6 100644 --- a/doc/automake.mk +++ b/doc/automake.mk @@ -121,6 +121,7 @@ FIGURE_SYNTAX = \ doc/pspp-figures/descriptives.sps \ doc/pspp-figures/flip.sps \ doc/pspp-figures/frequencies.sps \ + doc/pspp-figures/matrix-print.sps \ doc/pspp-figures/means.sps \ doc/pspp-figures/one-sample-t.sps \ doc/pspp-figures/independent-samples-t.sps \ diff --git a/doc/matrices.texi b/doc/matrices.texi index 8eb4842316..459940823f 100644 --- a/doc/matrices.texi +++ b/doc/matrices.texi @@ -1960,7 +1960,37 @@ subcommand, if any. Any other subcommands are ignored, and the command acts as if @code{MDISPLAY} is set to @code{TEXT} regardless of its actual setting. +The following syntax demonstrates two different ways to label the rows +and columns of a matrix with @code{PRINT}: +@example +MATRIX. +COMPUTE m=@{1, 2, 3; 4, 5, 6; 7, 8, 9@}. +PRINT m/RLABELS=a, b, c/CLABELS=x, y, z. + +COMPUTE rlabels=@{"a", "b", "c"@}. +COMPUTE clabels=@{"x", "y", "z"@}. +PRINT m/RNAMES=rlabels/CNAMES=clabels. +END MATRIX. +@end example + +@noindent +With @code{MDISPLAY=TEXT} (the default), this program outputs the +following (twice): + +@example +m + x y z +a 1 2 3 +b 4 5 6 +c 7 8 9 +@end example + +@noindent +With @samp{SET MDISPLAY=TABLES.} added above @samp{MATRIX.}, the +output becomes the following (twice): + +@psppoutput {matrix-print} @node Matrix DO IF Command @subsection The @code{DO IF} Command diff --git a/doc/pspp-figures/matrix-print.sps b/doc/pspp-figures/matrix-print.sps new file mode 100644 index 0000000000..240ed2172a --- /dev/null +++ b/doc/pspp-figures/matrix-print.sps @@ -0,0 +1,7 @@ +SET MDISPLAY=TABLES. +MATRIX. +COMPUTE m={1, 2, 3; 4, 5, 6; 7, 8, 9}. +COMPUTE rlabels={"a", "b", "c"}. +COMPUTE clabels={"x", "y", "z"}. +PRINT m/RNAMES=rlabels/CNAMES=clabels. +END MATRIX.