Anfängerfrage zu JSLIch möchte die ausgewählten Zeilen in einer CSV- oder JMP-Datei mit JSL speichern. Aber ich bin nicht in der Lage, es zu tun Kann mir jemand sagen, wie man es macht?
Ich habe es mit dem folgenden Code versucht, aber die Methode zum Speichern scheint falsch zu sein:
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" );AnalytikDatentabelleSkriptingFensterRe: Anfängerfrage zu JSLEs gibt viele Möglichkeiten, damit umzugehen.Ich gehe davon aus, dass Sie diese JSL mit der Partition()-Plattform aus Ihrer vorherigen Diskussion verwenden werden, so würde ich die Lösung angehen
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: Anfängerfrage zu JSLJa, es hängt mit der Partition()-Plattform zusammen. Aber wenn ich den Code zum Speichern der Daten ausführe, kann ich ihn nicht speichern. Ich habe meinen Code angehängt, weil ich nicht verstehen kann, wo der Code fehlschlägt, da im Protokoll kein Fehler angezeigt wird.
Re: Anfängerfrage zu JSLIch denke, Sie müssen den Programmablauf sehen, Sie können die Datei nicht speichern, bevor die Zeilen definiert sind.
Vielleicht zeigt dieses kleine Beispiel, wie Sie damit umgehen können, es speichert die ausgewählten Zeilen von der Partitionsplattform in einer Tabelle, wenn die Partition geschlossen wird. Aber wie Jim schon sagte: viele Möglichkeiten!
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: Anfängerfrage zu JSLIch habe einen Fehler in der JSL gemacht, die ich in meiner letzten Antwort angegeben habe.Seitdem habe ich meine Antwort korrigiert.
In dieser Antwort habe ich Ihre bereitgestellte JSL erweitert und ein vollständiges Beispiel bereitgestellt, das die untergeordnete Tabelle jedes Mal speichert, wenn eine neue Select Rows angegeben wird.
Der Zeilenstatushandler wird auch eliminiert, wenn das Partition()-Fenster geschlossen wird.
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 ) );