01-17-2017 02:21 PM
Hello, I have a question about do curve fitting after stop the while loop.
here is the situation, I build up a real-time system, so the signal value would change along time. after finish the record, i want to fit this curve.
initially, I put an express curve fitting function in the while loop , however it doesn' seem right.
Then I think the curve fitting should be done after stop the recording, there is, I use an event case that clicking the program stop button would lead to curve fitting.
but in the first step, i try to show the mutiple plot just like the one in while loop, I failed...
without this step, I don't think the curve fitting could be done.
but the other function in the event case are successful...like saving image or change some booling value.
01-17-2017 02:44 PM - edited 01-17-2017 02:44 PM
Hi mei,
I failed...
Well, you failed in a lot of ways (according to your description)… 😄
Most important: you forgot to attach your VI!
Attach your VI, tell us exactly where you are stuck, don't forget to embed useful default data in the VI (run the VI until you got good measurement data, then stop the VI, set all values to default in the edit menu, save the VI, attach it)!
01-18-2017 12:11 PM
The magic word is "state machine". Create a acquisition state, a fitting state, a shutdown state, and an idle state. And define transitions based on the current state and user interactions. Never exit the top-level while loop until you are completely done. Code needs to stay alive, not just run downhill into a black hole.
Please show us your code!
01-19-2017 02:23 PM - edited 01-19-2017 02:23 PM
@mei0512 wrote:
initially, I put an express curve fitting function in the while loop , however it doesn' seem right.
You need to tell us what right (and wrong) means. Since you have not replied in a while, I wonder if you solved the problem?