最初に単一のデータテーブルを開くスクリプトを実行しています。次に、Forループを実行して、CSVから後続のデータテーブルを開き、それらを最初のデータテーブルに連結します。スクリプトの実行を監視している間、スクリプトは適切に動作し、すべての行を最初のデータテーブルに追加しますが、スクリプトの最後で、それ以降の列の多くを削除し、519行のみになります。この後の行が削除されている理由がわかりません。どんな助けも素晴らしいでしょう!以下のコードを参照してください:
//Initiates data table to hold all the data
data = New Table( "3DMark_All Loops" );
//Choose folder containing all .zip files
directory = Pick Directory();
subDir = directory || "All Loops/";
Create Directory(subDir); //create a new sub directory
TheFileList = Files In Directory(directory); //zip files
nFiles = N Items(TheFileList); //get number of zip files in directory
For( i = 1, i < 21, i++,
//open the zip folder and create a list of the files inside
za = Open( directory || zipFolder, zip );
dirlist = za << dir;
Show( dirlist ); // see all contents of zipped folder;
//choose the file from the file list called "Monitoring.csv" and save it in the subdirectory "All Loops" as the Loop Number
For(j = 1, j <= N Items( dirlist ), j++,
file = dirlist[j];
If( Left(file, 3) == "Mon",
text = za << read( file );
current = Save Text File( char(subDir) || char(i) || ".csv", text );
);
);
//Open the .csv file that was just created in the subdirectory
dt_temp = Open(current);
//Select Column 1 and Convert Text to Columns using a ; delimiter
Column(dt_temp, 1) << Set Selected;
dt_temp << Text To Columns(
delimiter( ";" ),
columns(1)
);
//Delete column 1 (which is empty)
dt_temp << Delete Columns(1);
//Create a new column called Loop Number
New Column( "Loop Number", Numeric, Continuous );
//Fill in the loop number for all cells of this column
colLengthTemp = N Rows(dt_temp);
LoopNumber = {};
For (s = 1, s <= colLengthTemp, s++,
LoopNumber[s] = i;
);
:"Loop Number" << Set Values(LoopNumber);
//Concatenate this loops data to the master data table
data << Concatenate( dt_temp, Append to first table );
//Close this temporary data table without saving
Close( dt_temp, nosave );
Wait(.001);
);