COM object EvVariableBase

EvApplication > EvFileCollection > EvFile > EvVariablesCollection > EvVariableBase

 

View the COM map and the COM summary.

The EvVariableBase object gives access to information on and actions with a variable in an EV file. This includes acoustic, virtual and other Echoview variables.

You can use the EvVariableBase object to determine if the variable is an acoustic variable or a virtual variable. With this knowledge you can proceed to use the methods and properties of the EvVariableAcoustic object or the EvVariableVirtual object.

The EvFile.Variables[] property lists all of the variables in an EV file and is an EvVariablesCollection.

EvVariable base methods and properties:

AddExporter
AddVariable
AsVariableBase
AsVariableAcoustic
AsVariableVirtual
CloseAssociatedViews
ExportData
ExportEVD
ExportEVDRange
ExportSettings
ExportTrackToImage

Name
MeasurementCount
OpenView
Useable
VariableType

 

Description

ExportData

ExportData(string FileName, int FirstPing, int LastPing, double MaxFileSizeMB)

Summary

Export the data for the current variable. ExportData includes support for acoustic, position, attitude and movement variables.

Parameters
  • FileName
  • The name of file and path to export data to.
  • FirstPing
  • The ping to begin data export.
  • LastPing
  • The ping to end the data export.
  • MaxFileSizeMB (optional)
  • Specifies the Target file size (MB) (refer to Export options).
  • The default is -1 and exports a single file.
Return

True, if successful.

Notes:

  • Exports to a nominated filename with a default .csv extension (if no extension is specified). Other file extensions such as .mat (MATLAB) can be specified.
  • To export a whole echogram when the start and stop ping numbers are unknown, use -1 for the FirstPing and LastPing. For example:
    EvVar.ExportData "C:\Echoview exports\Test.mat", -1,-1, -1

MeasurementCount

(read-only) int MeasurementCount

Summary

Determine the number of pings/measurements in the specified variable. Echoview COM supports variable types as:

  • acoustic variables handled via AsVariableAcoustic
  • virtual variables handled via AsVariableVirtual
  • variables, which includes time series variables, handled via AsVariableBase
Example
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Connect to Echoview
Dim EV_FILE_PATH
EV_FILE_PATH = "YourEVFile.EV"

Dim TS_Name
TS_Name = "Arithmetic 1"

Dim EvApp, EvFile
Dim tsVar, tsVirtual

' Connect to Echoview
Set EvApp = CreateObject("EchoviewCom.EvApplication")
WScript.Echo "Connected to Echoview version: " & EvApp.Version

' Open the EV file with error checking
Set EvFile = EvApp.OpenFile(EV_FILE_PATH)
If EvFile Is Nothing Then
    WScript.Echo "Error: Could not open EV file: " & EV_FILE_PATH
    WScript.Quit
End If
WScript.Echo "Opened EV file: " & EV_FILE_PATH
 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Find the Time Series variable and error checking
Set tsVar = EvFile.Variables.FindByName(TS_Name)
If tsVar Is Nothing Then
    WScript.Echo "Error: Could not find variable '" & TS_NAME & "'"
    WScript.Quit
End If

' Cast to a base variable, with error checking
Set tsVirtual = tsVar.AsVariableBase
If tsVirtual Is Nothing Then
    WScript.Echo "Error: Variable '" & TS_NAME & "' Time Series not set."
    WScript.Quit
End If

'MeasurementCount
MsgBox "The MeasurementCount is " & tsVar.MeasurementCount

Snippet for tsvar, where FindByName is used with an acoustic variable string, then assigning tsVirtual to handle as an acoustic variable.

Set tsVirtual = tsVar.AsVariableAcoustic

Snippet for tsVar, where FindByName is used with a virtual variable string, then assigning tsVirtual to handle as a virtual variable.

Set tsVirtual = tsVar.AsVariableVirtual

See also

Scripting with COM objects
COM object hierarchy
EvVariableAcoustic
EvVariableVirtual
EvVariablesCollection