検索して置換するスクリプトピーク面積カウントが飽和したときに「飽和 (####)」を追加する GCMS プログラムを使用しています。これらの結果を Excel から JMP データ テーブルにエクスポートした後、これらの出現箇所を見つけて "saturated ()" を削除するスクリプトを実行したいと思いますが、数値は連続した 12,0 形式のままにします。
スクリプティングRe: 検索して置換するスクリプト上記のコードは、 JMP ログ. のように見える@txnelson 'Area' 列の処理方法については既に説明しました。 必要に応じて、パターン マッチング コードと彼の JSL を組み合わせて使用できます。
これらすべてのことから、入力の規則性について安全に想定できることになります。 パターンマッチングのアプローチは(わずかに)より一般的ですが(そして簡単にもっと一般的にすることができます)、あなたの場合は問題にならないかもしれません.
Re: 検索して置換するスクリプト面積列でこれを試してください
Names Default To Here( 1 );
dt = Current Data Table();
// Loop across all character columns and find those who have the pattern (###)
// and if found, then convert all columns
For( k = 1, k <= N Rows( dt ), k++,
If( Contains( :Area[k], "(" ),
:Area[k] = Word( 2, :Area[k], "()" )
)
);
:Area << data type( numeric ) << modeling type( continuous ) << Format( "Fixed Dec", 12, 0 );Re: 検索して置換するスクリプト悲しいことに、スクリプトを実行しても何も起こりませんでした。役立つ場合は、データのスクリーン ショットと列の属性を含めました。再度、感謝します!

Re: 検索して置換するスクリプト私が正しく理解していれば、これは使用するチャンスかもしれませんJMPのパターンマッチング(おかげで@Craige_Hales 


NamesDefaultToHere(1);
// Define a function
removeSaturated =
Function({inStr}, {Default Local},
// A pattern that will match a span of digits, with or without a leading '-'
digits = (""|"-") + patSpan("0123456789");
// Put the match into 'found' (might be identical to 'inStr')
patMatch(inStr, digits >? found);
// Return 'found' as a number
Num(found);
);
// Try it out
Print(removeSaturated("saturated( 635403558 )"));
Print(removeSaturated("saturated(635403558)"));
Print(removeSaturated("635403558"));
Print(removeSaturated("635403"));
Print(removeSaturated("-635403"));
Print(removeSaturated("saturated( -635403 )"));
Re: 検索して置換するスクリプトスクリプトは、"(" が最初の文字であり、")" が最後の文字であると想定しています。先頭または末尾に空白文字がある可能性はありますか?
このバージョンのスクリプトを試して、役立つかどうかを確認してください
Names Default To Here( 1 );
dt = Current Data Table();
// Get all character columns
colList = dt << get column names( character, string );
// Loop across all character columns and find those who have the pattern (###)
// and if found, then convert all columns
For( I = 1, i <= N Items( colList ), i++,
If( Left( Trim( Char( Column( dt, colList[i] )[1] ) ), 1 ) == "(" & Right( Trim( Char( Column( dt, colList[i] )[1] ) ), 1 ) == ")",
For( k = 1, k <= N Rows( dt ), k++,
If( Left( (Trim( Column( dt, colLIst[i] ) )[k]), 1 ) == "(",
Column( dt, colList[i] )[k] = Substr( Trim( Column( dt, colList[i] )[k] ), 2 )
);
If( Right( Trim( Column( dt, colList[i] )[k] ), 1 ) == ")",
Column( dt, colList[i] )[k] = Word( 1, Column( dt, colList[i] )[k], ")" )
);
);
// Convert to numeric, etc.
Column( dt, colList[i] ) << data type( numeric ) << modeling type( continuous ) << Format( "Fixed Dec", 12, 0 );
)
);Re: 検索して置換するスクリプトスクリプトをありがとう、しかし、私は十分に具体的ではなかったようです.スクリプトを書くことは私にとって非常に新しいことであり、数字の長さは問題ではないと思いました。それは間違っていたと思います。スクリプトをいじってみましたが、「saturated( 635403558 )」を 635403558 に変えることができませんでした。私はあなたの助けに感謝します。
Re: 検索して置換するスクリプトインタラクティブに、検索機能を使用して "(" と ")" をグローバルに置換するのは非常に簡単です。次に、属性の標準化を使用して、問題のすべての列を選択し、それらを数値、連続、形式 (12 月固定、12,0) に変更できます。
検索は次の場所で入手できます
編集=>検索=>検索
属性の標準化は、データ テーブルの左側にある [列] パネルの赤い三角形の下で利用できます。
これもトリックを実行する小さなスクリプトですが、大きなデータテーブルでは遅くなる可能性があります
Names Default To Here( 1 );
dt = Current Data Table();
// Get all character columns
colList = dt << get column names( character, string );
// Loop across all character columns and find those who have the pattern (###)
// and if found, then convert all columns
For( I = 3, i <= N Items( colList ), i++,
If( Left( char(Column( dt, colList[i] )[1]), 1 ) == "(" & Right( char(Column( dt, colList[i] )[1]), 1 ) == ")",
For( k = 1, k <= N Rows( dt ), k++,
If( Left( (Column( dt, colLIst[i] )[k]), 1 ) == "(",
Column( dt, colList[i] )[k] = Substr( Column( dt, colList[i] )[k] ,
2)
);
If( Right( (Column( dt, colList[i] )[k]), 1 ) == ")",
Column( dt, colList[i] )[k] = Word( 1, Column( dt, colList[i] )[k], ")" )
);
);
// Convert to numeric, etc.
Column( dt, colList[i] ) << data type( numeric ) << modeling type( continuous ) <<
Format( "Fixed Dec", 12, 0 );
)
);