How to run code from a later line multiple times without restarting the whole script?
I have a script that is over a hundred lines long. For sake of argument, lets say lines 1 to 100 take 30 seconds to process.
I am currently working on lines 101 – 130. This 30 line block of code relies on the data that is processed from lines 1 to 100. I am new to MATLAB, so a lot of my coding from lines 101 – 130 encounters errors frequently.
The issue is I have to re-run the code from line 1 just to see if a new change I’ve made to lines 101 to 130 actually works.
I have tried using breakpoints by setting a breakpoint at line 100. But after making a change then continuing my script from line 100, I still have to run the code from line 1 if I encounter an error from line 100 to 130.
My question therefore, is can I somehow ‘cache’ the data from line 1 to 100? Is it therefore possible to run my code from line 101 to 130 multiple times over as I make constant changes through multiple errors without ever going back to line 1?I have a script that is over a hundred lines long. For sake of argument, lets say lines 1 to 100 take 30 seconds to process.
I am currently working on lines 101 – 130. This 30 line block of code relies on the data that is processed from lines 1 to 100. I am new to MATLAB, so a lot of my coding from lines 101 – 130 encounters errors frequently.
The issue is I have to re-run the code from line 1 just to see if a new change I’ve made to lines 101 to 130 actually works.
I have tried using breakpoints by setting a breakpoint at line 100. But after making a change then continuing my script from line 100, I still have to run the code from line 1 if I encounter an error from line 100 to 130.
My question therefore, is can I somehow ‘cache’ the data from line 1 to 100? Is it therefore possible to run my code from line 101 to 130 multiple times over as I make constant changes through multiple errors without ever going back to line 1? I have a script that is over a hundred lines long. For sake of argument, lets say lines 1 to 100 take 30 seconds to process.
I am currently working on lines 101 – 130. This 30 line block of code relies on the data that is processed from lines 1 to 100. I am new to MATLAB, so a lot of my coding from lines 101 – 130 encounters errors frequently.
The issue is I have to re-run the code from line 1 just to see if a new change I’ve made to lines 101 to 130 actually works.
I have tried using breakpoints by setting a breakpoint at line 100. But after making a change then continuing my script from line 100, I still have to run the code from line 1 if I encounter an error from line 100 to 130.
My question therefore, is can I somehow ‘cache’ the data from line 1 to 100? Is it therefore possible to run my code from line 101 to 130 multiple times over as I make constant changes through multiple errors without ever going back to line 1? matlab, breakpoints, cache MATLAB Answers — New Questions









