Auxiliary Functions

Contents

Index

Auxiliary Functions

Load Data

PlateKinematics.LoadTXT_asStructFunction
LoadTXT_asStruct(filePath::String, structType::DataType; names=nothing, header=false, skipstart=0, skipblanks=true, comments=true, comment_char='#')

Load the content of a TXT file into a struct array. The structType must be one of FiniteRotCart, FiniteRotSph, EulerVectorCart or EulerVectorSph. The names of the columns must be provided in the names argument if header is false. If header is true, the names are extracted from the first row of the file. The skipstart argument is the number of lines to skip at the start of the file. If skipblanks is true, blank lines are skipped. If comments is true, lines starting with the comment_char are skipped.

Arguments

  • filePath: Path to the TXT file.
  • structType: Type of the struct to be loaded.
  • names: Names of the columns in the file, used as field names in struct constructor. (optional, default: nothing)
  • header: If true, the first row of the file is considered the header. If names is not provided, the header is used as field names. (optional, default: false)
  • skipstart: Number of lines to skip at the start of the file. (optional, default: 0)
  • skipblanks: If true, blank lines are skipped. (optional, default: true)
  • comments: If true, lines starting with the comment_char are skipped. (optional, default: true)
  • comment_char: Character that indicates a comment line. (optional, default: '#')

Returns

  • Array of structs of type structType.
source
PlateKinematics.ParseArray_asFiniteRotationFunction
ParseArray_asFiniteRotation(data::Matrix, names::Union{Vector, Matrix}, structType::DataType)

Parse a matrix of data into an array of FiniteRotCart or FiniteRotSph structs. The names of the columns must be provided in the names argument. The structType must be one of FiniteRotCart or FiniteRotSph.

Arguments

  • data: Matrix of data to be parsed.
  • names: Names of the columns in the data, used as field names in struct constructor.
  • structType: Type of the struct to be loaded. Options are FiniteRotCart or FiniteRotSph.

Returns

  • Array of structs of type structType.
source
PlateKinematics.ParseArray_asEulerVectorFunction
ParseArray_asEulerVector(data::Matrix, names::Union{Vector, Matrix}, structType::DataType)

Parse a matrix of data into an array of EulerVectorCart or EulerVectorSph structs. The names of the columns must be provided in the names argument. The structType must be one of EulerVectorCart or EulerVectorSph.

Arguments

  • data: Matrix of data to be parsed.
  • names: Names of the columns in the data, used as field names in struct constructor.
  • structType: Type of the struct to be loaded. Options are EulerVectorCart or EulerVectorSph.

Returns

  • Array of structs of type structType.
source

Save Data

PlateKinematics.SaveStruct_asTXTFunction
SaveStruct_asTXT(array::Writables, filePath::String; delimiter=' '::Char, fields=nothing::Union{Vector, Array, Nothing}, header=true::Bool, format=nothing::Union{Vector, Array, Nothing})

Save a structure to a text file. The function will save the structure in a tabular format.

Arguments

  • array:: An array of structures to save to file. May also be a single structure. Options are FiniteRotCart, FiniteRotSph, EulerVectorCart, EulerVectorSph, SurfaceVelocityVector.
  • filePath: The path to the file to save the structure to.
  • delimiter: The delimiter to use in the text file. Warning, \t may not work as expected. (optional, default=' ')
  • fields: The fields to save to the file. If nothing, all fields will be saved. (optional, default=nothing)
  • header: If true, a header will be added to the file, with the field names of the struct. (optional, default=true)
  • format: The format to save the fields in. If nothing, the default is "%.5f" for all columns. (optional, default=nothing)

Returns

  • Nothing
source