Problems updating variables from java generated m-files
Mostra commenti meno recenti
To analyse the output of one program, I have written a Java program that reads the output and write it to a series of m-files that contain two variables each.
In Matlab I read each series of m-files and plot it to visualize the data.
My problem is that Matlab are keeping old versions of the variables in stead of updating when reading the files. It gets an old version of the correct variable (from the correct file)
- I get no error message
- The file are flushed and closed in Java
- When I look at the m-files in the Matlab editor, they are indeed updated.
- If I alter one of the files and save it, Matlab reads the updated version of all the files in that directory.
- If I restart Matlab, the updated versions of all files are read.
- I use the 'run' function in Matlab to execute the m-files
- It seems like Matlab store an old version of the two variables for each file, and does not update from file.
I do not understand this, can anyone help me?
Risposta accettata
Più risposte (2)
Jarrod Rivituso
il 1 Mag 2011
Sounds like MATLAB isn't aware a file has changed, and might be using an old, cached version of it.
Two thoughts you might try...
- Have MATLAB refresh function and file system path caches
rehash
- Try to clear all things from memory (rehash might do this automatically, I'm not sure)
clear functions
Henry
il 4 Lug 2012
0 voti
Thanks! I had this same problem and had just been dealing with it for ages. I just put a clear(mfile) where mfile is the name of the mfile I was reading.
Categorie
Scopri di più su Startup and Shutdown in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!