.net programming unable to use existed methods
1 view (last 30 days)
Show older comments
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/239889/TIM%E5%9B%BE%E7%89%8720190926174340.png)
0 Comments
Accepted Answer
Steven Lord
on 26 Sep 2019
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 Comments
More Answers (0)
See Also
Categories
Find more on .NET Methods in MATLAB 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!