.net programming unable to use existed methods

1 次查看(过去 30 天)
It says The class Thorlabs.MotionControl.PolarizerCLI.Polarizer has no Constant property or Static method named 'GetDeviceInfo'. But I just copied the method from the list.
TIM图片20190926174340.png

采纳的回答

Steven Lord
Steven Lord 2019-9-26
The key word in the error message is Static.
The output of methods that you've shown indicates the Thorlabs.MotionControl.PolarizerCLI.Polarizer class does have a method named GetDeviceInfo. It also shows that GetDeviceInfo is not a Static method of the class.
A Static method of a class can be called using the name of the class, without an instance of the class as input. A non-Static method must accept an instance of the class. I'm betting serialNo is not an instance of that class but is probably a normal double array.
Looking at the list of methods, you probably need to call one of the Static methods Thorlabs.MotionControl.PolarizerCLI.Polarizer.CreateDevice or Thorlabs.MotionControl.PolarizerCLI.Polarizer.CreatePolarizer to create an instance of that class. Once you have an instance you can call GetDeviceInfo on that instance, something like:
myPolarizer = Thorlabs.MotionControl.PolarizerCLI.Polarizer.CreatePolarizer(necessaryInputs);
devInfo = GetDeviceInfo(myPolarizer);
I have no idea what inputs the CreatePolarizer or GetDeviceInfo methods require. You may need to refer to the help or doc for that class to learn the right way to call those methods.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 .NET Methods in MATLAB 的更多信息

标签

产品


版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by