根据匹配的列名称突出显示单元格我有一个脚本,将表中每个 Studentized 列的最小值涂成黄色。 我还想突出显示原始列中与这些值相邻的值。 例如,对于学生化残渣休息脉冲,休息脉冲列中与 -2.321144119 相邻的单元格,即 44。 我怎样才能在jsl中做到这一点? 正则表达式或匹配有帮助吗? 谢谢
dt = current data table();
col = dt << get column names( string );
nc = N Items( col );
For( i = 1, i <= nc, i++,
Cols = Column(dt,i);
If( Contains( col[i], "Studentized Resid" ),
Min = dt << get rows where(as column(Cols)==(Col Min( Cols )));
Cols << color cells(Yellow, Min);
)
);
我正在寻找这样的东西:

回复:根据匹配的列名称突出显示单元格@杰夫·珀金森嗨,杰夫,我已经解决了子字符串部分。 不过谢谢!!回复:根据匹配的列名称突出显示单元格@tx尼尔森你的意思是这样的吗?
dt = Current Data Table();
// I changed the name from "col" to colNameList to keep from
// it being confused with the variable "Cols". It isn't
// confusing to JMP, just to me
colNameList = dt << get column names( string );
nc = N Items( colNameLIst );
// Loop across all columns
For( i = 1, i <= nc, i++,
// Create a variable that contains the "column" representation
// of the column name string value
Cols = Column( dt, i );
// If the column name starts with the string "Studentized Resid"
// and if so, then process
// I changed this because your Substr() function below indicates
// that the column with "Studentized Resid" will be at the beginning
If( Left( colNameList[i], 17 ) == "Studentized Resid",
// Find the minimum value for the column
MinValue = Col Min( Cols );
// Find all of the rows that have the minimum value. There
// could be more than one row with the minimum value, but this
// code only uses the first row
MinRows = dt << get rows where( As Column( Cols ) == MinValue );
// Theoretically, there should always be a matching value for this,
// but it is a good way to make sure the code will not fail. Also,
// if you ever want to deal with the posibility of more than one
// row matching the minimum, you would do it using this type of
// code structure
If( N Rows( MinRows ) > 0,
Cols << color cells( Yellow, MinRows ),
//column( Substr( colNameList[i], 19 ) ) << color cells( Yellow, MinRows )
);<BR /> column( Substr( colNameList[i], 19 ) ) << color cells( Yellow, MinRows )
)
);
我成功了。 非常感谢指导..
回复:根据匹配的列名称突出显示单元格我可能没理解你的问题。如果您想为包含“Studentized .....”的列中找到的最小值附近的单元格着色,那么您所要做的就是这样做。您有列名称列表......colNamesList,并且您正在浏览这些列。当您找到其中包含“Studentized......”的列时,您会找到要着色的另一列的名称以及最小值的行。这意味着,您还知道与您要着色的单元格相邻的单元格......
column( Substr( colNameList[i], 19 ) ) << << color cells( Yellow, MinRows )<BR />
如果您在“Studentized......”列的着色之后添加此内容,它将为相应的单元格着色
回复:根据匹配的列名称突出显示单元格是个子字符串()功能你缺少什么?
resid_colname="Studentized Resid Rest Pulse";
//There are 19 characters in "Studentized Resid "
orig_colname = substr(resid_colname, 19);
show(orig_colname);
/*:
orig_colname = "Rest Pulse";
回复:根据匹配的列名称突出显示单元格@tx尼尔森嗨吉姆,如果我在这里遗漏了什么,我很抱歉。 我还想突出显示每个学生化专栏的相邻原始专栏。 我无法完成这项工作。
回复:根据匹配的列名称突出显示单元格这是对脚本的简单修改。它适用于您的示例数据,并且应适用于数据表中尽可能多的列
dt = Current Data Table();
// I changed the name from "col" to colNameList to keep from
// it being confused with the variable "Cols". It isn't
// confusing to JMP, just to me
colNameList = dt << get column names( string );
nc = N Items( colNameLIst );
// Loop across all columns
For( i = 1, i <= nc, i++,
// Create a variable that contains the "column" representation
// of the column name string value
Cols = Column( dt, i );
// If the column name starts with the string "Studentized Resid"
// and if so, then process
// I changed this because your Substr() function below indicates
// that the column with "Studentized Resid" will be at the beginning
If( Left( colNameList[i], 17 ) == "Studentized Resid",
// Find the minimum value for the column
MinValue = Col Min( Cols );
// Find all of the rows that have the minimum value. There
// could be more than one row with the minimum value, but this
// code only uses the first row
MinRows = dt << get rows where( As Column( Cols ) == MinValue );
// Theoretically, there should always be a matching value for this,
// but it is a good way to make sure the code will not fail. Also,
// if you ever want to deal with the posibility of more than one
// row matching the minimum, you would do it using this type of
// code structure
If( N Rows( MinRows ) > 0,
Cols << color cells( Yellow, MinRows )
);
// Output the requested values
Show( Substr( colNameList[i], 19 ), Cols[MinRows[1]] );
);
);
回复:根据匹配的列名称突出显示单元格我仍然无法弄清楚如何解决这个问题。 我查看了其他问题和脚本指南以找到我最近的脚本。
这是我最近的脚本:
dt = current data table();
col = dt << get column names( string );
nc = N Items( col );
For( i = 1, i <= nc, i++,
Cols = Column(dt,i);
If( Contains( col[i], "Studentized Resid" ),
Min = dt << get rows where(as column(Cols)==(Col Min( Cols )));
Cols << color cells(Yellow, Min);
//show(Loc())
MinValue = Col Min(Cols);
ColValue = As List(Cols << Get Values);
show(Loc(ColValue,MinValue));
show(substr(col[i], 19,100));
)
);
如果有人可以向我展示如何使用 Substring 方法来匹配列,我将非常感激。 先感谢您。
回复:根据匹配的列名称突出显示单元格这听起来是一个合理的方法。
回复:根据匹配的列名称突出显示单元格所有具有/匹配 Studentized 列的原始列都将突出显示。 我正在查看书写指南,并一直在尝试使用正则表达式匹配以及子字符串来提取其中不包含“学生化残差”的列名称。 我也在此处保留突出显示列的行号列表,希望它有助于实现我想要的。 任何更好的方法将不胜感激。@tx尼尔森
回复:根据匹配的列名称突出显示单元格您如何设想需要处理哪些列的输入?
您读过脚本指南吗?书中有很多例子可以给你一些想法。
帮助==>书籍==>脚本指南
回复:根据匹配的列名称突出显示单元格@pmroz谢谢您的回复,但是,我正在寻找一个更动态的解决方案来解决这个问题,因为我可能有
a) 很多列
b) 将来的不同列名称。
是否有任何 JMP 函数可以完成该任务? 谢谢
回复:根据匹配的列名称突出显示单元格这是使用硬编码列名称的一种方法:
dt = Current Data Table();
col = dt << get column names( string );
nc = N Items( col );
For( i = 1, i <= nc, i++,
Cols = Column( dt, i );
If( Contains( col[i], "Studentized Resid" ),
Min = dt << get rows where( As Column( Cols ) == (Col Min( Cols )) );
Cols << color cells( Yellow, Min );
:Rest Pulse << color cells( Yellow, Min );
:Run Pulse << color cells( Yellow, Min );
:Max Pulse << color cells( Yellow, Min );
);
);