Perl script messes with file descriptor in matlab -


I use a Perl script to replace some strings in the data string. The Perl script is called from within a matlab program, which writes the data file before the execution of the Perl script and after its execution

My matlab program will then write the data file, but for some reason it does not happen.

Here's a minimal example: Metlab code:

  f = fopen ('output.txt', 'a'); Fprintf (f, 'It has been written \ n'); Pearl ('replace.perl', 'output.txt'); Fprintf (f, 'this is not \ n'); [FNN Para] = FOPN (F) type ('output.txt'); Fclose (f);  

perl script:

  #! / Usr / bin / perl -i while ( 

The variable fname and perm is correctly assigned. The output of the type is only "This is written here".

I am quite new to Pearl and so maybe I make some rookie mistake in that script which I can not find. Thanks for helping.

is in secret -i . In-place editing in Perl, and many other programs, is done by opening the original file for reading, opening a temporary file to write, then unlinking the original file and renaming the template file in the name of the original file.

Now after running your Perl script, the bad matlab has no longer maintained a file which is now an unlink file. You continue to write, but there is no easy way to see what was written ... even if the file has not been changed from below the matlab, then you have to deal with the fact that it was a place to write in the place Now the file will no longer end.

Finally, you need to be careful about having too many two programs / users / computers in the same file in the same file Seeing Perar Areas close matlab File Open to add it again later, if it's really necessary.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -