Fri 19 Jul 2013 03:49:03 PM UTC, comment #2:
I'm guessing that this is only a problem with the gnuplot toolkit. Have you tried running the script with the FLTK toolkit?
For gnuplot, I can definitely reproduce this with the following:
The problem is that gnuplot is a separate program outside of Octave. To communicate with it we open up pipes. When you use 'fclose all' you are closing every pipe and file handle throughout Octave except for STDIN, STDOUT, and STDERR. Unfortunately there is no notification to Octave that the pipe has been closed so the next time you try and do something with graphics Octave encounters this unexpected situation and starts throwing errors.
As an immediate workaround, I would not use 'fclose all'. Instead, you should be tracking the file descriptors that you open and closing them individually.
|
Fri 19 Jul 2013 07:43:10 AM UTC, comment #1:
Somebody suggested a clean exit...
close all
fclose all
clear all
nonetheless... sometimes after a syntax error... where the plot is incomplete, or you close a plot manually.
error: fputs: invalid stream number = 14
error: called from:
error: /usr/share/octave/3.6.3/m/plot/__gnuplot_drawnow__.m at line 299, column 1
error: /usr/share/octave/3.6.3/m/plot/__gnuplot_drawnow__.m at line 84, column 16
error: /usr/share/octave/3.6.3/m/plot/figure.m at line 60, column 7
error: /home/imartinez/Documents/Inst_scripts/HP8510C_Spar.m at line 466, column 3
A long time ago there was a bug reporting some problems when the link was between gnuplot and octave wan not close in a clean way.
Anyway, the error always shows after having a syntax error... closing plots manually and running the script again. Right at the point where a call like
H4=figure(4);
plot(Frequency/1e9,20*log10(abs(S12M)),'m');
Most of the time close, clear and fclose work... but some times they do not.
|
Wed 17 Jul 2013 06:20:05 AM UTC, original submission:
Not sure what to do about this.
My script to control an HP8510C runs ok the first time, multiple plots, several generated files are ok.
Everything is closed and cleaned when it exits.
After it finishes the first time, and it runs again... after trying to plot the second figure....
Calculate, plot and save transimpedance(Zt) (y/n)?? (Enter => n)
Measure, plot and save S21 delay (y/n)?? (Enter => n)
Measure, plot and save S12 delay (y/n)?? (Enter => n)NP_test = 801
error: fputs: invalid stream number = 5
error: called from:
error: /usr/share/octave/3.6.3/m/plot/__gnuplot_drawnow__.m at line 299, column 1
error: /usr/share/octave/3.6.3/m/plot/__gnuplot_drawnow__.m at line 84, column 16
error: /usr/share/octave/3.6.3/m/plot/figure.m at line 60, column 7
error: /home/labuser/Windows_drive/Inst_programs/HP8510C_Spar.m at line 225, column 3
H1=figure(1);
plot(Frequency/1e9,20*log10(abs(S11M)),'b');
grid on;
xlabel('Frequency (GHz)');
ylabel(['S11 ' filename ' (dB)']);
set(gca,'XMinorTick','on','YMinorTick','on');
print(1, strcat('S11_', filename, '.png'), '-portrait');
#LINE 225 is below..
H2=figure(2);
plot(Frequency/1e9,20*log10(abs(S22M)),'r');
grid on;
xlabel('Frequency (GHz)');
ylabel(['S22 ' filename ' (dB)']);
set(gca,'XMinorTick','on','YMinorTick','on');
print(2, strcat('S22_', filename, '.png'), '-portrait');
The only option is to exit octave and run again.... bug???
|