I have multiple files that I want to perform some analysis on. I want to create a loop to open the file, perform the analysis, calculate a value "area under a curve" in this example and then make a summary table with the file name and area. I can open the files from a folder and perform the analysis. I am not sure how to create the summary table. I have given an example with 2 files but I have many more files I would like to process in this way. Any help or guidance is greatly appreciated! Also please let me know if this does not make sense or if more information is needed.
//point to file directory
path = Pick Directory( "Select Directory Containing Data Files" );
//Gets the list of files in the selected file folder
file_list = Files In Directory( path );
//i=0;open file
nfile_list = N Items( file_list );
For( i = 1, i <= nfile_list, i += 1,
//Set Current Directory( dir_DirectoryPath );
dt = Open( path || file_list[i], );
//Calculate area
dt = Current Data Table();
dt << clear row states;
obj3 = dt << Bivariate(
Y( :Name( "Data" ) ),
X( :Time ),
Fit Polynomial( 6, {Line Color( {212, 73, 88} )} ),
SendToReport( Dispatch( {}, "Bivar Plot", FrameBox, {Frame Size( 449, 411 )} ) )
);
//save graph to data dable
obj3 << Save Script to Data Table( "Area" );
//get the prediction formula string and calculate the area under the curve for 30 minute adsoription
fm = Report( obj3 )[Outline Box( "Polynomial ?" )][Text Edit Box( 1 )] << get text;
//get the string to the right of the equal sign and convert the string to an expression using Parse()
fm = Parse( Trim( Word( 2, fm, "=" ) ) );
area = Integrate( fm, :Time, 0, 3600 );
Caption( "The area under this curve is " || Char( area ) );
Print( area );
);
Example of Final Table I would like to have:
Any help with this would be greatly appreciated. Thanks