.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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/239889/TIM%E5%9B%BE%E7%89%8720190926174340.png)
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 .NET Methods in MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!