Add an example for MATRIX PRINT.
authorBen Pfaff <blp@cs.stanford.edu>
Mon, 25 Oct 2021 16:57:08 +0000 (09:57 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Mon, 25 Oct 2021 16:57:08 +0000 (09:57 -0700)
doc/automake.mk
doc/matrices.texi
doc/pspp-figures/matrix-print.sps [new file with mode: 0644]

index cb277a2e8897e330c654dd9d28b0180d5ec1136b..6d2e6ebcc68bac6a69977b372749abcefa79f60b 100644 (file)
@@ -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 \
index 8eb48423169ea5ff6c29cb574decd7df558ba1ee..459940823f8c1e5edc998e91111796fa77f48b16 100644 (file)
@@ -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 (file)
index 0000000..240ed21
--- /dev/null
@@ -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.