嗨,
我還是個初學者,希望我能順利解決這個問題!
我有一個名為“median_range_mm”的循環列,然後是“median_range_mm 2”,然後是“median_range_mm 3 ......”
一個名為“target_status”的關聯列然後是“target_status_2”.....
我想繪製一個連續分佈,所有中位數範圍都是1,2,3 ...... 在同一個窗口。但是我想要從目標狀態不同於5的中間範圍中過濾掉所有單元格。
希望我很清楚。這個代碼,我不知道如何在循環“for”中為目標狀態寫入過濾條件。
dt = Current Data Table();
/renaming columns<BR />For( i = 1, i <= 716, i++,<BR /> For( j = 0, j <= 65, j++,<BR /> If(<BR /> i == 1, Column( i ) << set name( "EVENT_BEGIN_OF_CAPTURE" ),<BR /> i == 10, Column( i ) << set name( "Temperature" ),<BR /> i == 16 + 11 * j, Column( i ) << set name( "target_status" ),<BR /> i == 17 + 11 * j, Column( i ) << set name( "median_range_mm" ),<BR /> )<BR /> )<BR />)<BR /><BR />
// for the first ranging column
valMax = Max( :Temperature[dt << get rows where( :target_status == 5 )] ); //max selection
For( d = 3, d <= N Rows( dt ), d++,
val1 = Column( "Temperature" )[d];
val2 = Column( "Temperature" )[d + 1];
dt << select where( val2 - val1 <= 0.1 * valMax ); //stability
);
// plot of the first ranging
New Window( "Only plot median range with a stable temperature",
H List Box(
Distribution(
Uniform Scaling( 1 ),
Continuous Distribution(
Column( :median_range_mm ),
Show Percents( 1 ),
Show Counts( 1 ),
Customize Summary Statistics( Minimum( 1 ), Maximum( 1 ), Median( 1 ), Set Alpha Level( 0.05 ) ),
/* it is the first column so I can write : "target_status" to call the column */ <BR /><FONT face="arial black,avant garde" color="#FF9900"><STRONG> Local Data Filter( Add Filter( columns( :target_status ), Where( :target_status == 5 ) ) );</STRONG></FONT>
)
);
<BR />// looking for the first max value of the ranging
maxValue = Max( :median_range_mm[dt << get rows where( :target_status == 5 )] );
minValue = Min( :median_range_mm[dt << get rows where( :target_status == 5 )] );
// Then look on the others columns
For( p = 2, p <= 64, p++,
nom = "median_range_mm " || Char( p ); // look at ranging median_range_mm 1, 2, 3 ...
col = Column( nom );
name = "target_status " || Char( p ); // look at target status associated
tgt = Column( name );
//dt << get rows where( Column( name ) == 5); // doesn't work
<STRONG> maxValueVar = Max( Column( nom )[dt << get rows where( Column( name ) == 5 )] );
minValueVar = Min( Column( nom )[dt << get rows where( Column( name ) == 5 )] );</STRONG>
If(
maxValueVar > maxValue, maxValue = maxValueVar,
minValueVar < minValue, minValue = minValueVar
);
);
For( g = 2, g <= 64, g++,
nom = "median_range_mm " || Char( g );
col = Column( nom );<BR /> /* there is difficutie*/<BR /><FONT face="arial black,avant garde" color="#FF9900"><STRONG> name = "target_status " || Char( g );
tgt = Column( name );</STRONG></FONT>
valueMax = Max( :Temperature );
For( h = 3, h <= N Rows( dt ), h++,
value1 = Column( "Temperature" )[h];
value2 = Column( "Temperature" )[h + 1];
dt << select where( value2 - value1 <= 0.1 * valueMax ); // this is for a plot with a stable temperature
);
Distribution(
Uniform Scaling( 1 ),
Continuous Distribution(
Column( col ),
Show Percents( 1 ),
Show Counts( 1 ),
Customize Summary Statistics( Minimum( 1 ), Maximum( 1 ), Median( 1 ), Set Alpha Level( 0.05 ) ),<BR /> /* there is the difficultie*/<BR /> /* I don't want to call all the columns " target_status 2 , 3 , 4 .... */ <BR /><FONT face="arial black,avant garde" color="#FF9900"><STRONG> Local Data Filter(
Add Filter( columns( Column( tgt ), Where( Column( tgt ) == 5 ) ) );</STRONG></FONT>
)
)
);
);
)
);
乾杯
一些一般的想法......
首先,我認為當需要對行狀態進行交互式操作時,數據過濾器是一個很棒的設備。看來在你的情況下,行狀態是由顯式循環控制的,所以我會直接用腳本操作行狀態,而不是過濾器。
其次,您可以使用任何布爾表達式作為數據表消息<< Select Where(布爾))的參數。使用<<排除消息關注此消息。行狀態將確定您的平台(例如,分佈)將不包括這些觀察。
第三,平台啟動消息可以包括可能在此問題中使用的Where(布爾)參數。
最後,我不確定New Window()函數中兩個循環的用途。最好將它們移到functfion之外,並使用Append()消息向窗口添加更多平台。