Bluetooth physiological data acquisition
Phil Davis
revdev at pdslabs.net
Fri Mar 9 17:44:57 EST 2007
Hi David,
Here's another approach:
To avoid spending time on file overhead during the data collection period, you
could collect the data into a variable. Then when data collection is finished,
write the variable (or put it into a local URL.)
Doing it this way also means the speed of putting the file in whatever location
you choose is a non-issue.
Of course it could be that the amount of time needed to write to a file is
negligible. In that case, I would probably use Mark's approach myself, since it
leaves data on the HD if the app dies during the collection process.
HTH -
Phil Davis
Mark Smith wrote:
> I think I would have script locals to hold the names of source and
> destination files, and then simply write to the destination file each
> time new data is read, closing it only when finished:
>
> local sSourceFile
> local sDestFile
>
> on run
> open file sDestFile for update
> nextUpdate
> end run
>
> on nextUpdate
> put char 5 to 8 (or whatever) of URL("file:" & sSourceFile) into tData
> write tData to file sDestFile
> if (your exit condition) then
> endProcess
> else
> send "nextUpdate" to me in 300 milliseconds
> end if
> end nextUpdate
>
> on endProcess
> close file sDestFile
> end endProcess
>
>
> You get the idea...
>
>
> Best,
>
> Mark
>
> On 9 Mar 2007, at 21:22, David Glasgow wrote:
>
>> I plan to time it all with a 'send doit to me in tmills milliseconds'
>> but I go a bit vague beyond that. Any suggestions about how to do the
>> read-append as efficiently as possible? Should I try to read the
>> specific bytes I want, or read and append the lot, then pick out the
>> parts I want later? It may be a dumb question, but if the source file
>> is in the same directory as the growing destination file, is it
>> quicker than if the destination file is 'way over there' buried 6 deep
>> in a different directory? Does an append get slower the larger the
>> destination file becomes? Finally, what is the most efficient way of
>> making the data read conditional? I had thought about putting a
>> 'repeat while' somewhere, but I am not sure where.
More information about the use-livecode
mailing list