I would like to execute my code in segments. Reasons include:
(1) I would like to interact with the plots or data tables in the middle of the script
(2) I would like to execute only part of my code, e.g. the segment for plotting while skipping the rest.
This can be done by using stop functions and/or by highlighting code that I want to run, but this becomes unwieldy and annoying as my program grows.
I'd like to know if there is a function like in Matlab that allows me to section the code and then run by section?
Thank you
Another method that can be used is to segment your code in Expr() sections. The code would look something like
a=Expr(
section a code
);
b=Expr(
section b code
);
c=Expr(
section c code
);
// To run the code from the b expr
b;
Are you asking about subroutines? See Help > Books > Scripting Guide and read about expressions and user functions.
JMP does not work in two different, separate modes. Interactive behavior is still available when a script is running.
You can also associate subroutines with objects in the user interface. This way, your script can present initial results but provide additional computation as needed.
To make things more manageable in the editor, you could use code folding, maybe with user-defined keywords. Also, you could split your code over multiple files and use 'Include()', though this may not help readability. And of course, defining your own JSL functions helps to tame code and also makes it more maintainable.
Another method that can be used is to segment your code in Expr() sections. The code would look something like
a=Expr(
section a code
);
b=Expr(
section b code
);
c=Expr(
section c code
);
// To run the code from the b expr
b;
Thanks very much! The combination of code folding and using expressions has helped me both manage the code appearance and execute specific blocks of code much more easily.
I frequently select the block of text I want to run and use the "Enter" key on the numeric keypad to run the selection. (Not the return key!)