¿Cómo guardo subconjuntos en carpetas separadas con script?Creé una secuencia de comandos que importará un archivo de Excel y realizará un análisis que producirá 3 subconjuntos. Cada subconjunto debe ser una carpeta diferente, pero quiero que los subconjuntos tengan el mismo nombre que el archivo de Excel que se importó para crear el subconjunto. ¿Cómo haría esto o al menos nombraría a cada subconjunto con un nombre específico y los guardaría en diferentes carpetas?
secuencias de comandosventanasRe: ¿Cómo guardo subconjuntos en carpetas separadas con script?Aquí hay un ejemplo de una manera de hacer esto
// 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: ¿Cómo guardo subconjuntos en carpetas separadas con script?Además de @txnelson respuesta extensa de , es posible que desee echar un vistazo a la función ConvertFilePath .Aunque, como sugiere el nombre, se puede usar para convertir rutas de archivos (por ejemplo, de formatos de Windows a MacOS, o de rutas relativas a rutas completas), me gusta porque me permite manipular rutas de archivos manteniendo separados el nombre del archivo y la información del directorio. , sin tener que preocuparse por la concatenación de cadenas.
p.ej
projectHomeFolder = FilePathDefinitions:getProjectHome();
path = convertFilePath("Master_Table.jmp",base(projectHomeFolder));Re: ¿Cómo guardo subconjuntos en carpetas separadas con script?¡Muchas gracias! Esto fue increíblemente útil