[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: To parametrize a file location
From: |
Van den Eynde Gert |
Subject: |
RE: To parametrize a file location |
Date: |
Thu, 25 Feb 1999 10:19:48 +0100 |
> Hi !
>
> I would like to parametrize where I could store a plot with Octave.
> I tried something like this after having ploted what I want on the
> screen but it does not work.
>
> gset term postscript eps color
> cmdoutput =
> sprintf("/home/lorient/ffa/ase/Mach_%.2f/OL.eps",Mach);
> gset output eval(cmdoutput)
> replot
>
Hi,
I wrote an mfile that creates an mfile and executes it next... Like
this:
%Suppose that FNAME_NOEXT is a string that contains the filename of
%the data file. For example 'dat1'
%The code below creates an mfile 'dat1plotdp.m' containing all
%commands for Gnuplot.
fid = fopen([FNAME_NOEXT,'plotdp.m'],'w');
fprintf(fid,'function [] = %splotdp(DP)\n',FNAME_NOEXT);
fprintf(fid,'gset term postscript eps monochrome\n');
fprintf(fid,'gset output ''%s_DP.eps''\n',FNAME_NOEXT);
fprintf(fid,'gset autoscale\n');
fprintf(fid,'gset yrange [-1.5:1.5]\n');
fprintf(fid,'gset title ''DP''\n');
fprintf(fid,'gset xlabel ''Time (s)'' \n');
fprintf(fid,'gset ylabel ''Error (%%)'' \n');
fprintf(fid,'gset nokey\n');
fprintf(fid,'time = length(DP)/2;\n');
fprintf(fid,'tt = 0:0.5:time;\n');
fprintf(fid,'n = min(length(tt),length(DP));\n');
fprintf(fid,'plot(tt(1:n),DP(1:n)) \n');
fprintf(fid,'gset output\n');
fclose(fid);
%And now we execute the mfile we created....
feval([FNAME_NOEXT,'plotdp.m'],100*DP./P(1:length(DP)));
Maybe there is a more elegant method (after running you got
lots of 'plot'-mfiles) but this worked for me...
Have a nice day,
Gert Van den Eynde
'''''
(-o-o-)
_________________________.oooO--(_)--Oooo._________________________
| Gert Van den Eynde mailto:address@hidden |
| SCK-CEN http://www.sckcen.be/people/gvdeynde |
| FLINS |
| Boeretang 200 |
| B-2400 Mol .oooO |
| Belgium ( ) Oooo. |
|___________________________\ (____( )____________________________|
\_) ) /
(_/