cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
MartinNovak
Level I

Adjusting experiment start

Hello,

 

I am new to JMP scripting, and struggle with probably easy issue.

 

I have stacked experimental data including columns with variable, value, unit, date and times.

I want to add a new column Relative Time (as in an example).

 

But I would like it to be capable to calculate the relative time starting in specific phase X (e.g. 102 in attached example).

The experimental data have different lengths so I would like to make a script that will create the Relative Time Column, adjusting the time zero by deducting the starting time of phase X.


(The experiments may last for several days with many phases and variables  - sometimes I have over Million of rows)

 

 

 

1 REPLY 1
jthi
Super User

Re: Adjusting experiment start

Because the measurements can span over multiple days you should create new column which has DATE and TIME combined (you can just sum them together) to avoid issues when day changes.

 

After that you could use formula like (:DATETIME is the new column you should create). This expects that you want the minimum datetime value of the phase 102:

:DATETIME - Min(:DATETIME[Loc(Current Data Table()[0, {"VARIABLE", "VALUE"}], {"phase", 102})]);

Min(:TIME[Loc(Current Data Table()[0, {"VARIABLE", "VALUE"}], {"phase", 102})]); is a bit complicated and you should take some time to see what it is doing. Scripting Index will most likely be helpful with this. I can also explain it in more detail if needed. You could also replace Loc function with Get Rows Where which is easier to understand:

Current Data Table() << Get Rows Where(:VARIABLE == "phase" & :VALUE == 102);

but might be slower in some cases.

-Jarmo

Recommended Articles