help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

This cant be right! Was String Manipulations


From: John L Daschbach
Subject: This cant be right! Was String Manipulations
Date: Fri, 01 Dec 1995 18:12:13 -0800 (PST)

John Utz wrote:

>HI again this is just too weird
>
>function fig ( functionname)
>
>% create the name of the file.
>prestring = strcat ( functionname, ".fig" )
>prefilenamestr = strcat ( """", prestring )
>filenamestr = strcat ( prefilenamestr, """" ) 
>
>OUTPUT: is this how this is supposed to work?
>
>octave:16> fig ("foo")
>prestring = foo.fig
>prefilenamestr = "foo.fig
>filenamestr = "foo.fig"
>octave:17>  

Here is how I do it, there may be others.
This is just an example.  Note the use of sprintf() and eval()

  #
  #  Now set up the plot
  #
  fbstring = sprintf("set nolabel");
  eval(fbstring);
  fblabelx = min(X) + 0.1 * (max(X) - min(X));
  fblabely = min(Y) + 0.8 * (max(Y) - min(Y));
  fbstring = sprintf("set label \"% .3f\" at %e, 
%e",flatband,fblabelx,fblabely);
  eval(fbstring);


Hope this helps.

-John


reply via email to

[Prev in Thread] Current Thread [Next in Thread]