Effacer les filtres
Effacer les filtres

passing MATLAB's handle objects to .NET function

3 vues (au cours des 30 derniers jours)
Bolivar
Bolivar le 1 Nov 2013
Modifié(e) : Doug Hull le 1 Nov 2013
Hello everyone!
Is that possible to give matlab oobject as argument to .Net function? Actually I want to execute some class member asynchroneously. Therefore, the BeginInvoke method should pass the handle of related object to asynchron function. I am using the NetDocDelegate.cs defined in the documentation to which I have added the following line :
public delegated double delRef(dynamic arg);
and my class definition is defined as :
classdef usier < handle
properties
stock
value
end
methods
function obj = usier(stock,value)
obj.stock = stock;
obj.value=value;
end
function receive(obj,objref)
divDel = NetDocDelegate.delRef(@response);
asyncRes =divDel.BeginInvoke(objref,@obj.display);
end
function result=response(obj)
result=[obj.stock,obj.value];
end
function dispay(obj,asyncRes)
result = asyncRes.AsyncDelegate.EndInvoke(asyncRes);
fprintf(1,'neighbor''s stock is:%d\t and value is:%d\n',result(1),result(2));
end
end
end
Then I created two instance of usier class
>>u=usier(12,34);
>> f=usier(45,98);
>> f.receive(u)
the last command should executes the asynchron function and then retreives the result. unfortunately matlab generate the following Error:
No method 'BeginInvoke' with matching signature found for class 'NetDocDelegate.delRef'.
ps:I added the assembly files first with
dllPath = fullfile('c:','MATLAB\DynChannel\','NetDocDelegate.dll');
NET.addAssembly(dllPath);
can someone help me?
Thanks all,
Bolivar

Réponses (0)

Catégories

En savoir plus sur Call Web Services from MATLAB Using HTTP dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by