41 #include <pds/pdsvector.h> 53 int function_octplot_vector_in_png(
const PdsVector *V,
const char *labelx,
const char *labely,
const char *octfile,
const char *pngfile)
59 if(V==NULL)
return FALSE;
60 if(labelx==NULL)
return FALSE;
61 if(labely==NULL)
return FALSE;
62 if(octfile==NULL)
return FALSE;
63 if(pngfile==NULL)
return FALSE;
65 fd=fopen(octfile,
"w");
66 if(fd==NULL)
return FALSE;
68 for(i=0 ; i<V->Nel ; i++) fprintf(fd,
"%e\t",V->V[i]);
70 fprintf(fd,
"plot(V,\'o-\');\n");
71 fprintf(fd,
"grid on;\n");
72 fprintf(fd,
"xlabel(\'%s\');\n",labelx);
73 fprintf(fd,
"ylabel(\'%s\');\n",labely);
74 fprintf(fd,
"print(\'%s\',\'-dpng\',\'-Farial:20\',\'-S800,600\');\n",pngfile);
79 orden=(
char *)calloc(1,32+strlen(octfile));
80 if(orden==NULL)
return FALSE;
81 sprintf(orden,
"octave --silent %s",octfile);