Dear community,
I am running a loop where some state variables are updated.
Sometimes I want to interrupt that loop using Ctrl+C, but I want to make sure that all my state variables have been updated for consistency.
Currently I have created a structure that embeds all my state variables that I update writting:
state = state_past;
The intent is to update all the structure content at once, making it unafectable by a Ctrl+C interruption.
Q1: Do you think updating a whole structure is not interrupted by Ctrl+C?
Rather than using this state structure approach, I was thinking to write all my updates on the same line this way:
t = t_past; x = x_past; y = y_past; % and so on...
Q2: Do you think Ctrl+C can not interrupt in the middle of this line?
Q3: Is there a way to make sure a complete bloc of code is executed together not being interrupted by Ctrl+C?
Thank you for your enlightments.
Best Answer