From: matt dash on
Hello all,
I have a function that works with data from a user-supplied text file. Is there a way to set up a "listener" so that if the file is modified outside of matlab, matlab will run some code (to re-import the new data)? I can easily do this in a way that sucks up all matlab's resources by constantly checking the file, but i'm looking for something that won't keep matlab busy. Toolbox and/or java solutions are welcome.

thanks!
From: Jan Simon on
Dear Matt Dash,

I do not know a callback method. But instead of wasting time, you can use a TIMER object to check the existence after some seconds only.
Be aware, that a file can exist, but not be completely written to the disk. So your function needs a possibility to find out, if the creation of the file is ready.

Kind regards, Jan
From: Steven_Lord on


"matt dash" <n.a(a)mail.com> wrote in message
news:i3uipb$3h6$1(a)fred.mathworks.com...
> Hello all,
> I have a function that works with data from a user-supplied text file. Is
> there a way to set up a "listener" so that if the file is modified outside
> of matlab, matlab will run some code (to re-import the new data)?

No; see my objection in post 4 in this thread from two days ago.

http://www.mathworks.com/matlabcentral/newsreader/view_thread/288828#769764

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com