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!