Octave Wiki | RecentChanges

CategoryFAQ

ScaryOctave > CategoryFAQ

Lots of people. It seems that universities use it for research and teaching, companies of all sizes, for development, individuals. This question comes often on Octave mailing lists, see WhoUsesOctave for a few answers

closeplot();
closefig(number)

Here is an untested code snippet for calling rand([9000,1]), modified from a post by HerberFarnsworth? to help-octave on 2003-05-01:

  #include <octave/oct.h>
  ...
  ColumnVector NumRands(2);
  NumRands(0) = 9000;
  NumRands(1) = 1;
  octave_value_list f_arg, f_ret;
  f_arg(0) = octave_value(NumRands);
  f_ret = feval("rand",f_arg,1);
  Matrix unis(f_ret(0).matrix_value());

  gset grid mxtics mytics
  gset grid lw 2, lw 0.1
  grid("on");
One can use postscript enhancement for proper axis

  gset format x "10^{%%L}"
or

  gset format y "10^{%%L}" 

Here is a awk script to get a rainbow color map

  #!/bin/awk -f
  
  BEGIN {
    split("0 4 6 7 5 3 1 2 8", raimbow, " ");
    split("7 3 1 0 2 4 6 5 8", invraim, " ");
  }
  
  $1 ~ /\/LT[0-8]/ {
    n = substr($1, 4, 1);
    if (n == 0)
      lt = "{ PL [] 0.9 0.1 0.1 DL } def";
    else if (n == 1)
      lt = "{ PL [4 dl 2 dl] 0.1 .75 0.1 DL } def";
    else if (n == 2)
      lt = "{ PL [2 dl 3 dl] 0.1 0.1 0.9 DL } def";
    else if (n == 3)
      lt = "{ PL [1 dl 1.5 dl] 0.9 0 0.8 DL } def";
    else if (n == 4)
      lt = "{ PL [5 dl 2 dl 1 dl 2 dl] 0.1 0.8 0.8 DL } def";
    else if (n == 5)
      lt = "{ PL [4 dl 3 dl 1 dl 3 dl] 0.9 0.8 0.2 DL } def";
    else if (n == 6)
      lt = "{ PL [2 dl 2 dl 2 dl 4 dl] 0.5 0.3 0.1 DL } def";
    else if (n == 7)
      lt = "{ PL [2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 1 0.4 0 DL } def";
    else if (n == 8)
      lt = "{ PL [2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 0.5 0.5 0.5 DL } def";
    $0 = sprintf("/LT%d %s", raimbow[n+1], lt);
    ##$0 = sprintf("/LT%x %s", invraim[n+1], lt);
    ##$0 = sprintf("/LT%x %s", n, lt);
  }
  
  { print; }
Look at functions like exist, file_in_path.. and the other functions that their descriptions point to.

  figure(1, "visible", "off");
  plot(sin(1:100));
  print -deps "/tmp/sin.eps"

  set(0, 'defaultfigurevisible', 'off');

    clear all;

This is a known problem if you have one of the following packages loaded: