How to call windows system .dll (CancellationToken)
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi Everyone,
I am currently trying to connect a ball bar sensor made by Renishaw to matlab for data collection, I have been given an API from the manufacturers who have never connected it to matalb before.
To do this I need to call a Windows CancellationToken which should be in System.Threading also stated here https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken?view=net-7.0
But when I try adding the System.Threading using NET.addAssembly('System.Threading') the assembly is empty. if I use NET.addAssembly('System') I get 664 classes but I can not see CancellationToken.
My Question is how do I call a CancellationToken or is it not possible?
Thank you for any help
댓글 수: 0
채택된 답변
Yash Sharma
2023년 9월 5일
Based on my understanding, you are trying to access the CancellationToken class from “System.Threading”, but it seems that the class is actually located in the "System.Runtime" assembly, as per the documentation link mentioned. To use CancellationToken, you can follow these steps:
% Set up the .NET environment for Core:
>> ne = dotnetenv("core");
% Add the "System.Runtime" assembly:
>> asm = NET.addAssembly('System.Runtime');
% Access the classes within the assembly:
>> asm.Classes
By executing these commands, you should be able to find the CancellationTokenSource class, which can be used further.
Find below the documentation of “dotnetenv” and “NET.addAssembly” functions.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!