matlab

package module
v0.0.0-...-d184de0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2022 License: MIT Imports: 8 Imported by: 0

README

Matlab

Apparently a parser for matlab 5.0 doesn't exist in go. So, here we are.

Documentation

Overview

Package matlab defines readers & writers for working with matlab .mat files

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataType

type DataType uint32

DataType represents matlab data types

const (
	DataTypeUnknown DataType = iota // errored data type
	DTmiINT8                        // 8 bit, signed
	DTmiUINT8                       // 8 bit, unsigned
	DTmiINT16                       // 16-bit, signed
	DTmiUINT16                      // 16-bit, unsigned
	DTmiINT32                       // 32-bit, signed
	DTmiUINT32                      // 32-bit, unsigned
	DTmiSINGLE                      // IEEE® 754 single format

	DTmiDOUBLE // IEEE 754 double format

	DTmiINT64      // 64-bit, signed
	DTmiUINT64     // 64-bit, unsigned
	DTmiMATRIX     // MATLAB array
	DTmiCOMPRESSED // Compressed Data
	DTmiUTF8       // Unicode UTF-8 Encoded Character Data
	DTmiUTF16      // Unicode UTF-16 Encoded Character Data
	DTmiUTF32      // Unicode UTF-32 Encoded Character Data
)

Data Types as specified according to byte indicators

func (DataType) String

func (d DataType) String() string

type Element

type Element struct {
	Type  DataType
	Value interface{}
}

Element is a parsed matlab data element

type File

type File struct {
	Header *Header
	// contains filtered or unexported fields
}

File represents a .mat matlab file

func NewFileFromReader

func NewFileFromReader(r io.Reader) (f *File, err error)

NewFileFromReader creates a file from a reader and attempts to read the header

func (*File) ReadElement

func (f *File) ReadElement() (el *Element, err error)

ReadElement reads a single Element from a file's reader

func (*File) WriteElement

func (f *File) WriteElement(e *Element) error

WriteElement writes a single element to a file's writer

type Header struct {
	Level     string
	Platform  string
	Created   time.Time
	Endianess binary.ByteOrder
}

Header is a matlab .mat file header

func (*Header) String

func (h *Header) String() string

String implements the stringer interface for Header with the standard .mat file prefix (without the filler bytes)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL