Prev: 2D multivariate Gaussian fitting
Next: Two-tank system
From: Enning Martin on 9 Aug 2010 03:07 Hello everybody, I have a programme, taht calculates signals an saves them in a csv-Data. Then I have a m-file that imports this csv-Data an works with it. Now I want the m-file to start automatically as soon as a new csv-Data is generated. Is this possible?
From: us on 9 Aug 2010 03:17 "Enning Martin" <martin.enning(a)audi.de> wrote in message <i3o9eq$q5t$1(a)fred.mathworks.com>... > Hello everybody, > > I have a programme, taht calculates signals an saves them in a csv-Data. > > Then I have a m-file that imports this csv-Data an works with it. > > Now I want the m-file to start automatically as soon as a new csv-Data is generated. > > Is this possible? a hint: - create a TIMER, which periodically checks the content of the folder for new files... help timer; us
From: the cyclist on 9 Aug 2010 09:16 "Enning Martin" <martin.enning(a)audi.de> wrote in message <i3o9eq$q5t$1(a)fred.mathworks.com>... > Hello everybody, > > I have a programme, taht calculates signals an saves them in a csv-Data. > > Then I have a m-file that imports this csv-Data an works with it. > > Now I want the m-file to start automatically as soon as a new csv-Data is generated. > > Is this possible? One possible solution: while 1 pause(5) % Check every 5 seconds if exist('full file name with extension.ext','file') break end end If you went with this, I would also put in some kind of break if the file doesn't show up for, say, three weeks. ;-) the cyclist
From: Steven_Lord on 9 Aug 2010 09:47 "Enning Martin" <martin.enning(a)audi.de> wrote in message news:i3o9eq$q5t$1(a)fred.mathworks.com... > Hello everybody, > > I have a programme, taht calculates signals an saves them in a csv-Data. > > Then I have a m-file that imports this csv-Data an works with it. > > Now I want the m-file to start automatically as soon as a new csv-Data is > generated. No, actually, you don't. You want the function to start automatically as soon as a new csv-Data file _has finished being generated_ rather than as soon as the csv-Data file _comes into existence._ If the file takes a significant amount of time to write to disk, the difference between those two scenarios could be very important. The easiest way to accomplish what you want is to have the program that writes the data, which is the only entity that knows when the csv file has been written completely, invoke the reader function. If that program is not a MATLAB function, you could try launching MATLAB with the -r flag, or you could try using COM to connect to the running MATLAB and kick off the command using that interface. -- 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
From: the cyclist on 9 Aug 2010 10:21
"Steven_Lord" <slord(a)mathworks.com> wrote in message <i3p0u4$5mh$1(a)fred.mathworks.com>... > > > "Enning Martin" <martin.enning(a)audi.de> wrote in message > news:i3o9eq$q5t$1(a)fred.mathworks.com... > > Hello everybody, > > > > I have a programme, taht calculates signals an saves them in a csv-Data. > > > > Then I have a m-file that imports this csv-Data an works with it. > > > > Now I want the m-file to start automatically as soon as a new csv-Data is > > generated. > > No, actually, you don't. You want the function to start automatically as > soon as a new csv-Data file _has finished being generated_ rather than as > soon as the csv-Data file _comes into existence._ If the file takes a > significant amount of time to write to disk, the difference between those > two scenarios could be very important. The easiest way to accomplish what > you want is to have the program that writes the data, which is the only > entity that knows when the csv file has been written completely, invoke the > reader function. If that program is not a MATLAB function, you could try > launching MATLAB with the -r flag, or you could try using COM to connect to > the running MATLAB and kick off the command using that interface. Excellent point, Steve. Yet another possibility is to, after the CSV is written, write a second file that triggers the read. |