How do I access Thorlabs Kinesis .NET functions in Matlab?

87 views (last 30 days)
I am attempting to program Thorlab KST Stepper Motor Controllers from Matlab. This simple script:
asm2=NET.addAssembly('C:\Program Files\Thorlabs\Kinesis\Thorlabs.MotionControl.GenericMotorCLI.dll');
sn1=('26001073');
Connect(Thorlabs.MotionControl.GenericMotorCLI.AdvancedMotor.GenericAdvancedMotorCLI,sn1)
generates the error:
Error using Thorlabs.MotionControl.GenericMotorCLI.AdvancedMotor.GenericAdvancedMotorCLI
Abstract classes cannot be instantiated. Class
'Thorlabs.MotionControl.GenericMotorCLI.AdvancedMotor.GenericAdvancedMotorCLI' defines abstract methods and/or
properties.
Thorlabs.MotionControl.GenericMotorCLI.AdvancedMotor.GenericAdvancedMotorCLI is a class in the .NET library:
Thorlabs.MotionControl.GenericMotorCLI.dll, and Connect(Thorlabs.MotionControl.GenericMotorCLI.GenericMotorCLI this, System.String serialNo) is listed as a method in that class.
Any suggestions would be appreciated.
  3 Comments

Sign in to comment.

Answers (1)

Raha
Raha on 8 May 2023
Edited: Walter Roberson on 8 May 2023
I have successfully used it in Matlab for KCube:
clear
clc
%Set path to the DLL files
NET.addAssembly('C:\Program Files\Thorlabs\APT\Thorlabs.MotionControl.DeviceManagerCLI.dll');
NET.addAssembly('C:\Program Files\Thorlabs\APT\Thorlabs.MotionControl.GenericMotorCLI.dll');
NET.addAssembly('C:\Program Files\Thorlabs\APT\Thorlabs.MotionControl.KCube.BrushlessMotorCLI.dll');
import Thorlabs.MotionControl.DeviceManagerCLI.*
import Thorlabs.MotionControl.GenericMotorCLI.*
import Thorlabs.MotionControl.KCube.BrushlessMotorCLI.*
DeviceManagerCLI.BuildDeviceList();
DeviceManagerCLI.GetDeviceListSize();
device = KCubeBrushlessMotor.CreateKCubeBrushlessMotor('yourserial number'); %The output of this line must be suppressed
device.Connect('YourserialNum');

Categories

Find more on Software Development Tools in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!