func (d *Driver) SaveMarkerTable(filename string) (status vi.Status) {
	status = d.SetMarkerTableOn()
	if status < vi.SUCCESS {
		return
	}
	b := fmt.Sprintf("MMEM:STOR:RES:MTAB '%s'", filename)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
SaveMarkerTable Saves the marker table to filename.
package mxa
import (
	"fmt"
	"os"
	"strconv"
	"strings"
	vi "github.com/jpoirier/visa"
)
type Driver struct {
	vi.Driver
}
func OpenGpib(rm vi.Session, ctrl, addr, mode, timeout uint32) (*Driver, vi.Status) {
	name := fmt.Sprintf("GPIB%d::%d", ctrl, addr)
	instr, status := rm.Open(name, mode, timeout)
	if status < vi.SUCCESS {
		fmt.Println("Error, OpenGpib failed with error: ", status)
		os.Exit(0)
	}
	return &Driver{instr}, status
}
func OpenTCP(rm vi.Session, ip string, mode, timeout uint32) (*Driver, vi.Status) {
	if len(ip) == 0 {
		fmt.Println("Error, empty ip address string.")
		os.Exit(0)
	}
	name := fmt.Sprintf("TCPIP::%s::INSTR", ip)
	instr, status := rm.Open(name, mode, timeout)
	if status < vi.SUCCESS {
		fmt.Println("Error, OpenGpib failed with error: ", status)
		os.Exit(0)
	}
	return &Driver{instr}, status
}
func (d *Driver) SetScreenTitle(title string) (status vi.Status) {
	b := fmt.Sprintf("DISP:ANN:TITL:DATA '%s'", title)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SaveScreenShot(name string) (status vi.Status) {
	b := fmt.Sprintf("MMEM:STOR:SCR '%s'", name)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) DeleteFile(name string) (status vi.Status) {
	b := fmt.Sprintf("MMEM:DEL '%s'", name)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) CreateFolder(name string) (status vi.Status) {
	b := fmt.Sprintf("MMEM:MDIR '%s'", name)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetTraceType(number int, stype string) (status vi.Status) {
	stype = strings.ToUpper(stype)
	var b string
	switch stype {
	default:
		return -1
	case "CLEAR", "WRITE":
		b = fmt.Sprintf("TRAC%d:TYPE WRITE", number)
	case "AVERAGE":
		b = fmt.Sprintf("TRAC%d:TYPE AVERAGE", number)
	case "MAX", "MAXH", "MAXHOLD":
		b = fmt.Sprintf("TRAC%d:TYPE MAXHOLD", number)
	case "MIN", "MINH", "MINHOLD":
		b = fmt.Sprintf("TRAC%d:TYPE MINHOLD", number)
	}
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetTraceClearWrite(trace uint32) (status vi.Status) {
	b := fmt.Sprintf("TRAC%d:TYPE WRITE", trace)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) ClearTrace(trace uint32) (status vi.Status) {
	b := fmt.Sprintf("TRAC:CLEAR TRACE%d", trace)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) ClearAllTraces() (status vi.Status) {
	b := []byte("TRAC:CLEAR:ALL")
	_, status = d.Write(b, uint32(len(b)))
	return
}
func (d *Driver) SetCenterFreqKHz(mhz float32) (status vi.Status) {
	b := fmt.Sprintf("FREQ:CENT %f KHZ", mhz)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetCenterFreqMHz(mhz float32) (status vi.Status) {
	b := fmt.Sprintf("FREQ:CENT %f MHZ", mhz)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetCenterFreqGHz(ghz float32) (status vi.Status) {
	b := fmt.Sprintf("FREQ:CENT %f GHZ", ghz)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) GetCenterFreqMHz() (mhz float32, status vi.Status) {
	b := []byte("FREQ:CENT?")
	_, status = d.Write(b, uint32(len(b)))
	if status < vi.SUCCESS {
		return
	}
	buffer, retCount, status := d.Read(50)
	if status < vi.SUCCESS && retCount > 0 {
		return
	}
	t, err := strconv.ParseFloat(string(buffer), 32)
	if err != nil {
		return mhz, -1
	}
	mhz = float32(t / 1000.0 / 1000.0)
	return
}
func (d *Driver) SetMarkerModeNorm(marker uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:MODE POS", marker)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerModeDelta(marker, relMarker uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:MODE DELT", marker)
	_, status = d.Write([]byte(b), uint32(len(b)))
	if status < vi.SUCCESS {
		return
	}
	b = fmt.Sprintf("CALC:MARK%d:REF %d", relMarker, 0)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerModeFixed(marker uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:MODE FIX", marker)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerFuncNoise(marker uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:FUNC NOISE", marker)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerFuncBandPower(marker uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:FUNC BPOW", marker)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerFuncBandDensity(marker uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:FUNC BDEN", marker)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerTraceNum(marker, number uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:TRAC %d", marker, number)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerLinesOn(marker uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:LINES ON", marker)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerLinesOff(marker uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:LINES OFF", marker)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerFuncOff(marker uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:FUNC OFF", marker)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerFuncBandSpanMHz(marker, mhz uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:FUNC:BAND:SPAN %f MHZ", marker, float32(mhz))
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerOff(marker uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:MODE OFF", marker)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetAllMarkersOff() (status vi.Status) {
	b := []byte("CALC:MARK:AOFF")
	_, status = d.Write(b, uint32(len(b)))
	return
}
func (d *Driver) SetMarkerXValMHz(marker, mhz uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:X %f MHZ", marker, float32(mhz))
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerYValDbm(marker uint32, dbm float32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:Y %f", marker, dbm)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerPeakSearch(marker uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:MAX", marker)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerNextPeak(marker uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:MAX:NEXT", marker)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerNextPeakR(marker uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:MAX:RIGHT", marker)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerNextPeakL(marker uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:MAX:LEFT", marker)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerContPeakOn(marker uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:CPSEARCH: ON", marker)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerContPeakOff(marker uint32) (status vi.Status) {
	b := fmt.Sprintf("CALC:MARK%d:CPSEARCH: OFF", marker)
	_, status = d.Write([]byte(b), uint32(len(b)))
	return
}
func (d *Driver) SetMarkerTableOn() (status vi.Status) {
	b := []byte("CALC:MARK:TABL ON")
	_, status = d.Write(b, uint32(len(b)))
	return
}
func (d *Driver) SetMarkerTableOff() (status vi.Status) {
	b := []byte("CALC:MARK:TABL OFF")
	_, status = d.Write(b, uint32(len(b)))
	return
}
func (d *Driver) SetPeakTableOn() (status vi.Status) {
	b := []byte("CALC:MARK:PEAK:TABL:STATE ON")
	_, status = d.Write(b, uint32(len(b)))
	return
}
func (d *Driver) SetPeakTableOff() (status vi.Status) {
	b := []byte("CALC:MARK:PEAK:TABL:STATE OFF")
	_, status = d.Write(b, uint32(len(b)))
	return
}