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

77 次查看(过去 30 天)
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 个评论

请先登录,再进行评论。

回答(1 个)

Raha
Raha 2023-5-8
编辑:Walter Roberson 2023-5-8
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');

类别

Help CenterFile Exchange 中查找有关 Software Development Tools 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by