Domanda per principianti su JSLVoglio salvare le righe selezionate in un file csv o jmp usando JSL. Ma non sono in grado di farlo Qualcuno può dirmi come farlo?
Ho provato con il seguente codice ma il modo per salvarlo sembra essere sbagliato:
f = Function( {a},
theRows = Current Data Table() << get selected rows;
Show( theRows );
);
rs = Current Data Table() << make row state handler( f );
filepath = "C:\Users\abc\Desktop\trial";
rs << save( filepath || "\" || "part1.jmp" );AnalisiTabella datiScriptingfinestreRe: Domanda per principianti su JSLCi sono molti modi per gestire questo.Presumo che utilizzerai questo JSL con la piattaforma Partition() dalla tua discussione precedente, questo è il modo in cui mi avvicinerei alla soluzione
f = Function( {a},
theRows = Current Data Table() << get selected rows;
Show( theRows );
);
rs = Current Data Table() << make row state handler( f );
filepath = "C:\Users\abc\Desktop\trial";
rs << save( filepath || "\" || "part1.jmp" );Re: Domanda per principianti su JSLSì, è correlato alla piattaforma Partition() Ma quando eseguo il codice per salvare i dati, non riesco a salvarlo. Ho allegato il mio codice perché non sono in grado di capire dove il codice non funziona poiché nel registro non mostra alcun errore.
Re: Domanda per principianti su JSLPenso che tu debba vedere il flusso del programma, non puoi salvare il file prima che le righe siano definite.
Può essere che questo piccolo esempio mostri come è possibile gestire, salva le righe selezionate dalla piattaforma di partizione in una tabella, quando la partizione è chiusa. Ma come ha detto Jim: molti modi!
Names Default To Here( 1 );
// opens partition platform on Big Class data table
// when rows are selected, and platform is closed, selected rows are saved in separate data table
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
obj = Partition( Y( :weight ), X( :sex, :height ), Method( "Decision Tree" ), Validation Portion( .2 ) );
obj << split best();
// When partition window is closed do this:
obj << on close(
If( N Items( dt << get selected rows() ) > 0,
dtTemp = dt << subset( invisible, selected rows( 1 ), selected columns( 0 ) );
filepath = "$TEMP";
Close( dttemp, save( filepath || "\" || "part1.jmp" ) );
// open file again
Open( filepath || "\" || "part1.jmp" );
)
);
Re: Domanda per principianti su JSLHo commesso un errore nel JSL che ho fornito nella mia ultima risposta.Da allora ho corretto la mia risposta.
In questa risposta, ho ampliato il JSL fornito e fornito un esempio completo che salverà la tabella con sottoinsiemi ogni volta che viene specificata una nuova Seleziona righe.
Il gestore dello stato della riga viene eliminato anche quando la finestra Partition() viene chiusa.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\semiconductor capability.jmp" );
tableCount = 0;
theRows = [];
f = Function( {a},
// Set dupRows to the previously selected rows
dupRows = theRows;
// Get the current selected rows
theRows = Current Data Table() << get selected rows;
If( N Rows( theRows ) > 0,
// check to see if there are the same number of rows and if yes
// then validate the rows are different rows before saving
If( N Rows( theRows ) == N Rows( dupRows ),
If( Sum( dupRows == theRows ) != N Rows( theRows ),
tableCount++;
dtTemp = dt << subset( invisible, selected rows( 1 ), selected columns( 0 ) );
filepath = "$TEMP";
Close(
dtTemp,
save( filepath || "\" || "part" || Char( tableCount ) || ".jmp" )
);
Current Data Table( dt );
);
,
// If not the same number of selected rows, save the subset
tableCount++;
Show( tableCount );
dtTemp = dt << subset( invisible, selected rows( 1 ), selected columns( 0 ) );
filepath = "$TEMP";
Close( dtTemp, save( filepath || "\" || "part" || Char( tableCount ) || ".jmp" ) );
Current Data Table( dt );
)
);
);
rs = Current Data Table() << make row state handler( f );
obj = Partition(
Y( :NPN1 ),
X( :PNP1, :PNP2, :PNP3, :PNP4, :NPN2, :NPN3, :NPN4 ),
Method( "Decision Tree" ),
Validation Portion( .2 )
);
obj << ShowGraph( 0 );
obj << SplitBest( 4 );
obj << Show Split Count( 1 );
obj << Show Split Prob( 1 );
Wait( .5 );
//obj << Save Predicteds;
obj << on close( Clear Symbols( rs ) );