I am running optimization code in MATLAB, which requires a fitness value from a model compatible with Octave (I cannot use MATLAB to solve this model, therefore Octave.). For this, I wrote a fitness function in MATLAB, which looks like this:
fid = fopen('parameter.txt','w');
for i=1:length(x)
% fprintf(fid,'%e \n',x(i));
fprintf(fid,'%12.5f \n',x(i));
end
fclose(fid);
system('./dswrap');
% get the objective fitness value:
fid = fopen('fitness.txt','r');
y=fscanf(fid,'%f',[1]);
fclose(fid);
- x is the input vector for the model that goes into the .txt parameter
- fitness.txt - exit from. / dswrap
dswrap is C code that looks like this
int main()
{
FILE*fp,*fp_r;
fp=popen("octave","w");
fprintf(fp,"ObjFuS");
pclose(fp);
}
This calls an octave and then calls ObjFus, which takes input from the .txt parameter and outputs it to the fitness.txt file. The problem I am facing is not. Ftf.txt is not generated, and after some twiddling I see one problem as
sh: octave: command not found
. , ?
, - . , fitness.txt. .