The first time running the script shown below returns this error "Name Unresolved: m{36803} in access or evaluation of 'm', m/*###*/", while every subsequent run does not return that error. Why is this?
DataCV=open("C:\Desktop\JMP\sample_CV_data.csv");
Summarize( DataCV, processArray = By( :process ) );
Summarize( DataCV, ctypeArray = By( :c_type ) );
For( n = 1, n <= Length( ctypeArray ), n++, // Generates and saves all splines by :c_type and :process
For( m = 1, m <= Length( processArray ), m++,
Eval(
Substitute(
Expr(
biv = Bivariate(
Y( :c_mm_deembed_pf ),
X( :v_dut_volt ),
Where( :c_type == __ctype__ & :process == __process__ ),
Fit Spline( 0.1, standardized, {save predicteds} )
)
),
Expr( __process__ ), processArray[m],
Expr( __ctype__ ), ctypeArray[n],
)
)
);
);
(Data Table( DataCV ) << Tabulate( // Create new table
Add Table(
Column Table( Analysis Columns( :Spline Predictor for c_mm_deembed_pf Where ) ),
Row Table( Grouping Columns(:serial_num, :process, :c_type, :v_dut_volt ) )
)
)) << Make Into Data Table;
currentDataTable()<<AddRows(1); // Add an empty last row so while loop knows when its at the end
q = 0;
proc = "new";
i = 1;
while(q == 0, // Delete redundant splines (:process x :c_type combinations)
if (proc != (Row()=i;:process),
proc = (Row()=i;:process); sn = (Row()=i;:serial_num); i+=1
);
if (proc == (Row()=i;:process) & sn == (Row()=i;:serial_num),
i+=1
);
if (proc == (Row()=i;:process) & sn != (Row()=i;:serial_num),
CurrentDataTable()<<DeleteRows(i)
);
if ((Row()=i;:process) == "",
q = 1;
);
);
currentDataTable() << Delete Rows(i); // Delete empty last row
currentDataTable() << new column("Index", character);
cap = "new";
for (k = 1, k<=NRows(currentDataTable()), k++, // Add VARs for ADS indexing
if (cap != :c_type[k],
currentDataTable() << Add Rows(1, k-1); j=1; cap = :c_type[k+1]; proc = :process[k+1]
);
if (j==1,
For Each Row(:Index = if(:c_type=="",
"\!NVAR CURVE(1) = " || char(cap) || "\!NVAR TECH(1) = " || char(proc) || "\!NBEGIN\!N% ind(1) dep(1)",
:Index));
For Each Row(:c_type = if(:c_type=="",
char(cap),
:c_type)); j=0
);
);
currentDataTable() << delete columns("c_type", "serial_num", "process"); // Delete all rows except for ind(1) and dep(1)
xptPref = Get Preferences( Export Settings ); // .MDF format
Preferences(
ExportSettings(
End Of Line( CRLF ),
End Of Field( Tab ),
Export Table Headers( 0 )
)
);
currentDataTable () << Save As( "C:\JMP\GeneratedFiles\RoughDraft2Output.mdf", "text" ); // Save as .MDF