cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
LEDmaker
Level I

Sectioning or Segmenting Code in JSL

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

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Sectioning or Segmenting Code in JSL

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;
Jim

View solution in original post

5 REPLIES 5

Re: Sectioning or Segmenting Code in JSL

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.

ian_jmp
Level X

Re: Sectioning or Segmenting Code in JSL

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.

txnelson
Super User

Re: Sectioning or Segmenting Code in JSL

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;
Jim
LEDmaker
Level I

Re: Sectioning or Segmenting Code in JSL

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.

Craige_Hales
Super User

Re: Sectioning or Segmenting Code in JSL

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!)

Craige