謝謝!這是非常可行的,只花了幾分鐘才弄清楚我需要編輯什麼,所以它會做我想要的,有可能我可以在某些時候使它更有效率,一旦我更好地理解腳本,但這肯定會我想要它做什麼!
dt = Open();
col_list = dt << get column names( string );
Remove From( col_list, 1 ); // Remove time[sec] from list
cols_to_plot = {};
offset_list = {};
offset_cols = {};
// Define the graph builder commands in an expression for use by the OK button
graph_expr = Expr(
For( i = 1, i <= N Items( cols_to_plot ), i++,
new_name = cols_to_plot[i] || "-Offset";
Insert Into( offset_cols, new_name );
dt << New Column( new_name,
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( As Column( dt, cols_to_plot[i] ) * offset_list[i] )
);
);
// Now for the graph - build a text string and then execute it
gb_text = "\[gb = graph builder(
show control panel(0),
variables(
X( :Name( "Time[sec]" ) ),]\";
elements_txt = " ),
Elements( Line( X, ";
For( i = 1, i <= N Items( cols_to_plot ), i++,
If( i == 1,
// then
gb_text = gb_text || Eval Insert( "\!N\[ Y( :Name( "^offset_cols[i]^" ) ), ]\" )
,
// else
gb_text = gb_text || Eval Insert( "\!N\[ Y( :Name( "^offset_cols[i]^" ), Position( 1 ) ),]\" )
);
elements_txt = elements_txt || Eval Insert( "Y ( ^i^ ), " );
);
elements_txt = elements_txt || "Legend( 7 ) ) ,";
gb_text = gb_text || elements_txt || ") )";
Eval( Parse( gb_text ) );
);
nw = New Window( "Graph Chemicals",
Panel Box( "Select channels to graph",
Lineup Box( N Col( 2 ),
Text Box( "Column" ),
Text Box( "Offset" ),
cb1 = Check Box( "Ch1" ),
ch1_neb = Number Edit Box(),
cb2 = Check Box( "Ch2" ),
ch2_neb = Number Edit Box(),
cb3 = Check Box( "Ch3" ),
ch3_neb = Number Edit Box(),
cb4 = Check Box( "Ch4" ),
ch4_neb = Number Edit Box(),
cb5 = Check Box( "Ch5" ),
ch5_neb = Number Edit Box(),
cb6 = Check Box( "Ch6" ),
ch6_neb = Number Edit Box(),
cb7 = Check Box( "Ch7" ),
ch7_neb = Number Edit Box(),
cb8 = Check Box( "Ch8" ),
ch8_neb = Number Edit Box(),
),
),
Panel Box( "Actions",
H List Box(
okb = Button Box( "OK",
If( cb1 << get( 1 ),
Insert Into( cols_to_plot, col_list[5] );
offset_value = ch1_neb << get;
Insert Into( offset_list, offset_value );
);
If( cb2 << get( 1 ),
Insert Into( cols_to_plot, col_list[6] );
offset_value = ch2_neb << get;
Insert Into( offset_list, offset_value );
);
If( cb3 << get( 1 ),
Insert Into( cols_to_plot, col_list[7] );
offset_value = ch3_neb << get;
Insert Into( offset_list, offset_value );
);
If( cb4 << get( 1 ),
Insert Into( cols_to_plot, col_list[8] );
offset_value = ch4_neb << get;
Insert Into( offset_list, offset_value );
);
If( cb5 << get( 1 ),
Insert Into( cols_to_plot, col_list[9] );
offset_value = ch5_neb << get;
Insert Into( offset_list, offset_value );
);
If( cb6 << get( 1 ),
Insert Into( cols_to_plot, col_list[10] );
offset_value = ch6_neb << get;
Insert Into( offset_list, offset_value );
);
If( cb7 << get( 1 ),
Insert Into( cols_to_plot, col_list[11] );
offset_value = ch7_neb << get;
Insert Into( offset_list, offset_value );
);
If( cb8 << get( 1 ),
Insert Into( cols_to_plot, col_list[12] );
offset_value = ch8_neb << get;
Insert Into( offset_list, offset_value );
);
graph_expr;
nw << close window;
),
canb = Button Box( "Cancel", nw << close window ),
)
),
);
// Pre-check checkboxes if column exists
For( i = 1, i <= N Items( col_list ), i++,
If(
col_list[i] == "Ch1", cb1 << set( 1, 1 ),
col_list[i] == "Ch2", cb2 << set( 1, 1 ),
col_list[i] == "Ch3", cb3 << set( 1, 1 ),
col_list[i] == "Ch4", cb4 << set( 1, 1 ),
col_list[i] == "Ch5", cb4 << set( 1, 1 ),
col_list[i] == "Ch6", cb4 << set( 1, 1 ),
col_list[i] == "Ch7", cb4 << set( 1, 1 ),
col_list[i] == "Ch8", cb4 << set( 1, 1 ),
)
);
有一堆原始數據線對於我們對數據的處理是不必要的,因此它將新修改的行放在電子表格的後面,但是現在很容易使用,非常感謝!
這應該讓你開始。 這裡有一些高級技術,尤其是動態創建圖形。
dt = New Table( "chemical", Add Rows( 10 ),
New Column( "Time[sec]", Numeric, "Continuous", Format( "Best", 12 ),
Set Values( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] ) ),
New Column( "Ch1", Numeric, "Continuous", Format( "Best", 12 ),
Set Values(
[0.405479144770652, 0.96118725137785, 0.184666735585779,
0.0779315158724785, 0.27096574800089, 0.274306696141139,
0.499865497928113, 0.645765431923792, 0.850604736013338,
0.375170755432919] ) ),
New Column( "Ch2", Numeric, "Continuous", Format( "Best", 12 ),
Set Values(
[-1.49768617758238, 0.627178362585814, 0.444456848007608,
0.23009213128918, 0.191183820733896, -0.871513987372999,
0.117414289530274, 0.673226666360769, 2.21437748894808,
-0.757598019757669] ) ),
New Column( "Ch3", Numeric, "Continuous", Format( "Best", 12 ),
Set Values(
[0.58753531659022, 0.722538525937125, 0.305761067429557,
0.53906583529897, 0.635318850399926, 0.701098019722849,
0.746448054211214, 0.526889791944995, 0.749249363318086,
0.959693510085344] ) )
);
col_list = dt << get column names(string);
remove from(col_list, 1); // Remove time[sec] from list
cols_to_plot = {};
offset_list = {};
offset_cols = {};
// Define the graph builder commands in an expression for use by the OK button
graph_expr = expr(
for (i = 1, i <= nitems(cols_to_plot), i++,
new_name = cols_to_plot[i] || "-Offset";
insertinto(offset_cols, new_name);
dt << new column(new_name, Numeric, "Continuous", Format( "Best", 12 ),
Formula( as column(dt, cols_to_plot[i]) * offset_list[i] ) );
);
// Now for the graph - build a text string and then execute it
gb_text =
"\[gb = graph builder(
show control panel(0),
variables(
X( :Name( "Time[sec]" ) ),]\";
elements_txt = " ),
Elements( Line( X, ";
for (i = 1, i <= nitems(cols_to_plot), i++,
if (i == 1,
// then
gb_text = gb_text || evalinsert("\!N\[ Y( :Name( "^offset_cols[i]^" ) ), ]\");
,
// else
gb_text = gb_text || evalinsert("\!N\[ Y( :Name( "^offset_cols[i]^" ), Position( 1 ) ),]\");
);
elements_txt = elements_txt || evalinsert("Y ( ^i^ ), ");
);
elements_txt = elements_txt || "Legend( 7 ) ) ,";
gb_text = gb_text || elements_txt || ") )";
eval(parse(gb_text));
);
nw = new window("Graph Chemicals",
panel box("Select channels to graph",
lineup box(ncol(2),
text box("Column"), text box("Offset"),
cb1 = checkbox("Ch1"), ch1_neb = number edit box(),
cb2 = checkbox("Ch2"), ch2_neb = number edit box(),
cb3 = checkbox("Ch3"), ch3_neb = number edit box(),
cb4 = checkbox("Ch4"), ch4_neb = number edit box(),
),
),
panelbox("Actions",
hlistbox(
okb = button box("OK",
if (cb1 << get(1),
insertinto(cols_to_plot, col_list[1]);
offset_value = ch1_neb << get;
insertinto(offset_list, offset_value);
);
if (cb2 << get(1),
insertinto(cols_to_plot, col_list[2]);
offset_value = ch2_neb << get;
insertinto(offset_list, offset_value);
);
if (cb3 << get(1),
insertinto(cols_to_plot, col_list[3]);
offset_value = ch3_neb << get;
insertinto(offset_list, offset_value);
);
if (cb4 << get(1),
insertinto(cols_to_plot, col_list[4]);
offset_value = ch4_neb << get;
insertinto(offset_list, offset_value);
);
graph_expr;
nw << close window;
),
canb = button box("Cancel", nw << close window;
),
)
),
);
// Pre-check checkboxes if column exists
for (i = 1, i <= nitems(col_list), i++,
if (col_list[i] == "Ch1", cb1 << set(1, 1),
col_list[i] == "Ch2", cb2 << set(1, 1),
col_list[i] == "Ch3", cb3 << set(1, 1),
col_list[i] == "Ch4", cb4 << set(1, 1),
);
);
Damion,
您沒有提到您正在使用的JMP版本,以及您將使用的JMP圖形/平台。每個列中的第一行也存儲化學名稱,或者名稱僅為Ch1,Ch2,...,Ch8
JMP具有相當標準的圖形和分析界面。 我假設你可以使用X的Fit Y,其中Y是化學物質(Ch1-Ch8),X是時間[秒]。 在添加每種化學品之前,右鍵單擊,然後選擇變換>縮放偏移 ,看屏幕截圖。使用1作為乘數,並指定偏移量。將轉化的化學物質用於Y.

這不是自動提示,而是通過用戶界面(UI)執行此操作的方法。
當然,您的任務可以使用JMP腳本語言(JSL)自動化並根據您的特定需求進行定制。
關於只讀入選定Excel列的請求,有多種方法可以做到這一點,但這取決於你的excel文件的設置方式,或者你是否有一個ODBC連接來讀取Excel作為數據庫等。 如果您可以提供虛擬Excel工作表,則可能會得到更具體的響應。