ループ内で垂直方向に連結しながらメモリを節約するこんにちは!
ディレクトリ内の複数のテーブルからのクエリ結果を 1 つのテーブルに連結しようとしています。ループを使用してテーブルを読み取り/クエリし、結果を連結しています。結果テーブルは問題ありませんが、中間の各連結テーブルが開き続けてメモリを消費します。
各中間結果テーブルを開かずに、ループの完了後にのみ結果テーブルとして表示できるデータ フレームのみを更新するための提案をありがとうございます。
JMP17プロを使用しています。
names default to here(1);<BR />dirLoc=Pick Directory("Select a directory", "myDirectory\");
fileList = Files In Directory(dirLoc);
dt1 = open(dirLoc || fileList[1]);
dt1 << Select Where( :Amount >= 500 );
x=dt1 << Subset ( Output Table Name("T1") );
Close(dt1, NoSave);
For(i = 2, i <= N Items( fileList ), i++,
dt = open(dirLoc || fileList[i] );
dt << Select Where( :Amount >= 500 );
y = dt << Subset ( Output Table Name("Temp"));
x = x << Concatenate( y);
Close(dt, NoSave);
Close(y, NoSave);
);
result = x<<SUBSET></SUBSET>
<LINGO-LABS id="lingo-labs-718508" slang="en-US" mode="CREATE"><LINGO-LABEL>自動化とスクリプト作成</LINGO-LABEL></LINGO-LABS>Re: ループ内で垂直に連結しながらメモリを節約するThere might be some misunderstanding here. Doing x << Concatenate( x, y ) will not update x, it will create a new table.
To update x with the values of y, use the literal expression x << Concatenate( y, "Append to First Table" )
また、リソースを節約するためにこれらすべてをプライベート テーブルとして実行し、最後に次のようにテーブルを表示することを検討してください。
Names Default To Here( 1 );
dirLoc = Pick Directory( "Select a directory", "myDirectory\" );
fileList = Files In Directory( dirLoc );
dt1 = Open( dirLoc || fileList[1], Private );
dt1 << Select Where( :Amount >= 500 );
x = dt1 << Subset( Output Table Name( "T1" ), Private );
Close( dt1, NoSave );
For( i = 2, i <= N Items( fileList ), i++,
dt = Open( dirLoc || fileList[i], Private );
dt << Select Where( :Amount >= 500 );
y = dt << Subset( Output Table Name( "Temp" ), Private );
x << Concatenate( y, "Append to First Table" );
Close( dt, NoSave );
Close( y, NoSave );
);
x << Set Name( "Result" );
x << New Data View;
Re: ループ内で垂直に連結しながらメモリを節約する連結ではなく追加するという提案をありがとうございます。実際に以下のように追記してみました。問題は、ループ内で中間テーブルが追加されるたびに、すべての中間テーブルがポップアップされることです。
x << Concatenate(x,y);
何か考えはありますか?
Re: ループ内で垂直に連結しながらメモリを節約する連結されたテーブルを追加する必要があります。デフォルトでは、JMP はテーブルを新しいテーブルに連結します。
names default to here(1);dirLoc=Pick Directory("Select a directory", "myDirectory\");
fileList = Files In Directory(dirLoc);
dt1 = open(dirLoc || fileList[1]);
dt1 << Select Where( :Amount >= 500 );
x=dt1 << Subset ( Output Table Name("T1") );
Close(dt1, NoSave);
For(i = 2, i <= N Items( fileList ), i++,
dt = open(dirLoc || fileList[i] );
dt << Select Where( :Amount >= 500 );
y = dt << Subset ( Output Table Name("Temp"));
x << Concatenate( y, "Append to First Table" );
Close(dt, NoSave);
Close(y, NoSave);
);
result = x<<SUBSET></SUBSET>