スクリプトを使用してサブセットを別のフォルダーに保存するにはどうすればよいですかファイルをインポートして Excel 化し、3 つのサブセットを生成する分析を実行するスクリプトを作成しました。 各サブセットは異なるフォルダーである必要がありますが、サブセットを作成するためにインポートされた Excel ファイルと同じ名前にする必要があります。 これをどのように行うか、少なくとも各サブセットに特定の名前を付けて、それらを別のフォルダーに保存します。
スクリプティングウィンドウズRe: スクリプトを使用してサブセットを別のフォルダに保存するにはどうすればよいですかこれを行う1つの方法の例を次に示します
// Open a file and create 2 subsets and then save all 3 files to
// different folders, keeping the files open in the JMP session,
// and with their original name, but naming each subset in their
// folders where they are saved
Names Default To Here( 1 );
// open the Big Class data table.
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Create subset one with all Males, letting JMP provide the new data table name
dt << select where( :sex == "M" );
dtA = dt << subset( selected columns( 0 ), selected rows( 1 ) );
// Create subset two with all Females, giving JMP the name of the new table
dt << select where( :sex == "F" );
dtB = dt << subset( selected columns( 0 ), selected rows( 1 ), Output Table( "All Females" ) );
// The Save() function automatically changes the name of the data table being saved
// to the name being specified in the file name specified in the Path of the Save()
// function. Therefore to keep the original table the original name, it has to be
// renamed back to the original name.
holdName = dt << get name;
dt << save( "C:/folderA/MyName.jmp" );
dt << set name( holdName );
// Repeat the save for the first subset
holdName = dtA << get name;
dtA << save( "C:/folderB/MyName.jmp" );
dtA << set name( holdName );
// Repeat for the second subset. The name of this subset has been specifically provided
// so the handling of this can be a little different
Data Table( "All Females" ) << save( "C:/folderC/MyName.jmp" );
Data Table( "MyName" ) << set name( "All Females" );
Re: スクリプトを使用してサブセットを別のフォルダに保存するにはどうすればよいですかに加えて@txnelsonの広範な答え、関数を見てみたいかもしれませんConvertFilePath .名前が示すように、ファイル パスの変換 (Windows から MacOS フォーマットへ、または相対パスから完全パスへなど) に使用できますが、ファイル名とディレクトリ情報を分離したままファイル パスを操作できるので気に入っています。 、文字列の連結について心配する必要はありません。
例えば
projectHomeFolder = FilePathDefinitions:getProjectHome();
path = convertFilePath("Master_Table.jmp",base(projectHomeFolder));Re: スクリプトを使用してサブセットを別のフォルダに保存するにはどうすればよいですかどうもありがとう! これは信じられないほど役に立ちました