Function File: figure_export_ascii(nfig, output_filename)
Function File: figure_export_ascii(nfig, output_filename, sample_rate)

Creates an ASCII file to be imported by MS Excel from all figures in range nfig Only those curves will be written to the ASCII file which have a name.

nfig array of figure handles

output_filename name of the output file

sample_rate define this value to an integer higher than one in order to reduce the amount of data

Demonstration 1

The following code

 hfig = [];
 fd = -1;
 unwind_protect
 [fd, output_file] = mkstemp("figure_export_ascii_XXXXXX", true);
 x = linspace(0, 2 * pi, 10);
 y = [sin(x); cos(x)];
 for i=1:rows(y)
   hfig(end + 1) = figure("visible", "off");
   for j=1:2
     subplot(2, 1, j);
     hold on;
     for k=1:2
       plot(x, y(i, :), sprintf("-;y%d=f%d(x%d);1", i, j, k));
     endfor
     xlabel("x");
     ylabel("y");
     title(sprintf("figure(%d) axes(%d)", i, j));
   endfor
 endfor
 figure_export_ascii(hfig, output_file, 2);
 spawn_wait(spawn("cat", {output_file}));
 unwind_protect_cleanup
  for i=1:numel(hfig);
    close(hfig(i));
  endfor
  if (fd ~= -1)
    fclose(fd);
    unlink(output_file);
  endif
 end_unwind_protect

gives an example of how 'figure_export_ascii' is used.

Package: mboct-octave-pkg