I have some MATLAB Analysis apps that run daily at midnight via TimeControl. The problem is, if I want to modify the app, the only option is "run and save" - and because they write data points, and there is no facility to delete data points, it's a conundrum - I pollute the target channel.
It'd be nice to be able to do a "save and sandbox run" or "save and run with writes disabled" or something, in order to make a change, verify its operation, but not mess with associated TimeControl actions.
Thanks for the feedback. We will consider adding an option to run in "sandbox" mode and also delete individual data points in a future release.
In the meanwhile, a couple options that I use in this situation are:
1. Comment the 'thingSpeakWrite()' line until I am satisfied with the code in the App. Uncomment it after and "Run and save" it again.
2. If I need to write the data to a channel, I create a new channel to verify the workflow. After verifying the workflow and the data, I change the writechannelID to point to the desired channel and then "Run and Save" it again.
Or you could add a little bit of logic to your code that discovers the time of day and only writes to the real channel when the time is right (see http://au.mathworks.com/help/matlab/ref/clock.html)
Obviously you need to test the logic on a seperate channel until you are happy that it works..
As a last resort you could remove polluted data by downloading the whole channel as CSV, removing the extraneous points in a spreadsheet, R or your language of choice, deleting all the channel data then re-importing the clean version.
I often lead my "once a day" analysis with code like:
[lastvalue,dateLastAnalyzed] = thingSpeakRead(30040,'ReadKey','yadayada','Field',2,'URL', 'http://api.thingspeak.com');
if dateLastAnalyzed < datetime('today','TimeZone','UTC')
Most Users Ever Online: 114
Currently Online: cstapels, jacktheripper125
Currently Browsing this Page:
Guest Posters: 1
Administrators: Hans, lee