closing file stream during early program termination (matlab)
Author |
Message |
chopperdudes
|
Posted: Fri May 06, 2011 1:18 am Post subject: closing file stream during early program termination (matlab) |
|
|
i've only seen turing do this on its own... how do you close a stream when the user decides to interrupt and end the program? reason being i'm working on a matlab script file which communicates using TCP/IP with another program, when something doesn't go right, i.e. infinite loop and i have to end it myself (ctrl c), matlab would leave the port hanging and so i would have to restart the other program. are there any ways to do this? or work arounds? (i.e. have a thread running and detect a keyboard input which will terminate the program). right now it may be development inconvenience, but i'm pretty sure this problem will actually lower the usefulness of the matlab program.
thx |
|
|
|
|
|
Sponsor Sponsor
|
|
|
mirhagk
|
Posted: Fri May 06, 2011 8:22 am Post subject: RE:closing file stream during early program termination (matlab) |
|
|
I don't know much about mat lab, but if it's event driven you could simply capture the end program command. Otherwise I don't see a way. |
|
|
|
|
|
chopperdudes
|
Posted: Fri May 06, 2011 11:35 am Post subject: RE:closing file stream during early program termination (matlab) |
|
|
thx, but problem solved, there's apparently this function called onCleanup to do it for you. although onCleanup cannot be used on the script level only inside functions. just putting it here for future reference if anyone decides to search this forum for this topic. |
|
|
|
|
|
|
|