changeset 7256:be3280acbdb8

[project @ 2007-12-05 01:08:17 by jwe]
author jwe
date Wed, 05 Dec 2007 01:08:17 +0000
parents 3aa50748a300
children e8a3e3e33490
files doc/interpreter/plotimages.m doc/interpreter/sparseimages.m
diffstat 2 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/plotimages.m	Tue Dec 04 23:42:30 2007 +0000
+++ b/doc/interpreter/plotimages.m	Wed Dec 05 01:08:17 2007 +0000
@@ -18,7 +18,9 @@
 
 function plotimages (nm, typ)
   bury_output ();
-  if (strcmp (nm, "plot"))
+  if (strcmp(typ , "txt"))
+    image_as_txt(nm);
+  elseif (strcmp (nm, "plot"))
     x = -10:0.1:10;
     plot (x, sin (x));
     print (strcat (nm, ".", typ), strcat ("-d", typ))    
@@ -63,10 +65,17 @@
   bury_output ();
 endfunction
 
-## Use this function before plotting commands and after every call to
-## print since print() resets output to stdout (unfortunately, gnpulot
-## can't pop output as it can the terminal type).
 function bury_output ()
   f = figure (1);
   set (f, "visible", "off");
 endfunction
+
+## generate something for the texinfo @image command to process
+function image_as_txt(nm)
+  fid = fopen (sprintf ("%s.txt", nm), "wt");
+  fputs (fid, "\n");
+  fputs (fid, "+---------------------------------+\n");
+  fputs (fid, "| Image unavailable in text mode. |\n");
+  fputs (fid, "+---------------------------------+\n");
+  fclose (fid);
+endfunction
--- a/doc/interpreter/sparseimages.m	Tue Dec 04 23:42:30 2007 +0000
+++ b/doc/interpreter/sparseimages.m	Wed Dec 05 01:08:17 2007 +0000
@@ -37,9 +37,6 @@
   endif
 endfunction
 
-## Use this function before plotting commands and after every call to
-## print since print() resets output to stdout (unfortunately, gnpulot
-## can't pop output as it can the terminal type).
 function bury_output ()
   f = figure (1);
   set (f, "visible", "off");
@@ -60,6 +57,7 @@
       sparse(ceil([1:n]/2),1:n,1,n,n);
   if (strcmp (nm, "gplot") || strcmp (nm, "grid"))
     fid = fopen (sprintf ("%s.txt", nm), "wt");
+    fputs (fid, "\n");
     fputs (fid, "+---------------------------------+\n");
     fputs (fid, "| Image unavailable in text mode. |\n");
     fputs (fid, "+---------------------------------+\n");
@@ -113,6 +111,7 @@
 
 function printsparse(a,nm)
   fid = fopen (nm,"wt");
+  fputs (fid, "\n");
   for i = 1:size(a,1)
     if (rem(i,5) == 0)
       fprintf (fid,"         %2d - ", i);
@@ -236,6 +235,7 @@
 function sombreroimage (nm, typ)
   if (strcmp (typ, "txt"))
     fid = fopen (sprintf ("%s.txt", nm), "wt");
+    fputs (fid, "\n");
     fputs (fid, "+---------------------------------------+\n");
     fputs (fid, "| Image unavailable because of a        |\n");
     fputs (fid, "| missing sparse matrix implementation. |\n");