Navigation: Scripting Reference Manual > Functions & Subroutines > DeleteMzrResult

 

DeleteMzrResult

 

Contact Us: fredsupport@photonengr.com

 

Description

This command deletes an optimization result from the results list at the specified index and returns the number of results remaining in the list.

 

 

Syntax

resultCount = DeleteMzrResult( resultIndex)

 

 

Parameters

resultCount (Long)

Returned number of results remaining in the list after deletion.

 

resultIndex As Long

Index into the results list (0 based) indicating the result to be deleted.

 

Example

The following example loops over the optimization results list and writes out the data for each result to a text file using a custom subroutine.

 

Sub Main

 

 

    'File where optimization results are being written

    Dim outFile As String

    outFile = "C:\temp\optimizationResults.txt"

    Open outFile For Output As #1

 

    'Number of results in the current list

    Dim numResults As Long

    numResults = GetMzrResultCount()

 

    'Loop over results, write to file

    Dim res As T_MZRRESULT

    Dim curResult As Long

    For curResult = numResults-1 To 0 Step -1

        GetMzrResult( curResult, res )

        printResultToFile( res )

    Next curResult

 

    'Close output file

    Close #1

 

End Sub

 

Sub printResultToFile( ByVal res As Variant )

 

    'Print result generic info

    Print #1, "BEGIN RESULT INFO"

    Print #1, Chr(9) & "Comment: " & res.comment

    Print #1, Chr(9) & "Merit Function: " & res.meritfunc

    Print #1, ""

 

    'Print result variable information

    Dim curVar As Long

    For curVar = 0 To UBound( res.variables, 1 )

        Print #1, Chr(9) & "Variable " & curVar & ":"

        Print #1, Chr(9) & Chr(9) & "Active: " & res.variables(curVar).active

        Print #1, Chr(9) & Chr(9) & "Value: " & res.variables(curVar).currentvalue

        Print #1, Chr(9) & Chr(9) & "Description: " & res.variables(curVar).Description

        Print #1, Chr(9) & Chr(9) & "Entity: " & res.variables(curVar).entity

        Print #1, Chr(9) & Chr(9) & "Fraction Step: " & res.variables(curVar).fracstep

        Print #1, Chr(9) & Chr(9) & "Fraction Variable: " & res.variables(curVar).fractionvar

        Print #1, Chr(9) & Chr(9) & "Index: " & res.variables(curVar).index

        Print #1, Chr(9) & Chr(9) & "Initial Value: " & res.variables(curVar).initialvalue

        Print #1, Chr(9) & Chr(9) & "Lower Limit: " & res.variables(curVar).lowerlimit

        Print #1, Chr(9) & Chr(9) & "Script: " & res.variables(curVar).Script

        Print #1, Chr(9) & Chr(9) & "Sub-index: " & res.variables(curVar).subindex

        Print #1, Chr(9) & Chr(9) & "Type: " & res.variables(curVar).Type

        Print #1, Chr(9) & Chr(9) & "Upper Limit: " & res.variables(curVar).upperlimit

        Print #1, ""

    Next curVar

 

End Sub

 

See Also

Optimization Script Commands

 

 

 

 

 

Copyright © Photon Engineering, LLC