필터 지우기
필터 지우기

.Net Object not displaying properties or methods

조회 수: 2 (최근 30일)
Faraz
Faraz 2014년 2월 21일
댓글: Christopher McClellan 2016년 5월 13일
I have a .dll file and I need for it to work in matlab. (The dll file was created by C# and I have the code for it as well)
Following the online tutorial on mathworks, I found out that the following command will load up the dll file in Matlab and make its classes available for use "in Matlab". But it does not appear to be working. I used this to load up the file:
color = NET.addAssembly('c:\path\to\file\EvolutionMapsClassLib.dll');
It load up fine and I see a 1 x 1 .net assemble object in my workspace.. When I type ``color`` I get the following result:
color =
NET.Assembly handle
Package: NET
Properties for class NET.Assembly:
AssemblyHandle
Classes
Structures
Enums
GenericTypes
Interfaces
Delegates
So apparently it has loaded up properly, furthermore typing ``color.Classes`` gives the following:
>> color.Classes
ans =
'EvolutionMaps.EvolutionMap'
'EvolutionMaps.EvolutionMap+EstimationResults'
'EvolutionMaps.PrincipalDirectionEvolutionMap'
'EvolutionMaps.CharacterDimensionsEstemator'
'EvolutionMaps.MapBlob'
'EvolutionMaps.MapsMetric'
'EvolutionMaps.MapsMetric+MapMinimalComparable'
'EvolutionMaps.MapsL2Distance'
'EvolutionMaps.DiagonalEvolutionMap'
'EvolutionMaps.EvolutionMapGenerator'
'EvolutionMaps.HeightEvolutionMap'
'EvolutionMaps.FullnessEvolutionMap'
'EvolutionMaps.YvalEvolutionMap'
'EvolutionMaps.ImageExtractor'
'EvolutionMaps.HorisontalProjectionDistance'
'EvolutionMaps.StrokeWidthEvolutionMap'
'EvolutionMaps.ConnectedComponentsFinder'
'EvolutionMaps.ColorMap'
'EvolutionMaps.ColorMap+GrayColorMap'
'EvolutionMaps.ColorMap+JetColorMap'
'EvolutionMaps.TransitionAvgEvolutionMap'
'EvolutionMaps.PrincipalProjectionEvolutionMap'
'EvolutionMaps.ConnectedComponent'
'EvolutionMaps.WidthEvolutionMap'
That appears to be working well, but according to the online help, in order to interact with these classes I need to know the methods and properties.
this is where I am having problems, as neither ``properties`` nor ``methods`` seem to work. I tried every variation to get the properties or the methods list but I keep getting this error:
>> properties color.EvolutionMaps.ColorMap
No properties for class color.EvolutionMaps.ColorMap or no class color.EvolutionMaps.ColorMap.
>> properties color.Classes.EvolutionMaps.ColorMap
No properties for class color.Classes.EvolutionMaps.ColorMap or no class color.Classes.EvolutionMaps.ColorMap.
>> properties Classes.EvolutionMaps.ColorMap
No properties for class Classes.EvolutionMaps.ColorMap or no class Classes.EvolutionMaps.ColorMap.
Same is the case with ``methods``, I keep getting this error:
>> methods color
No methods for class color or no class color.
Where as when I open the source code for this dll it shows all the methods and properties as can be seen from this screenshot: http://i.imgur.com/zlhLm8b.png
So how can I make the .Net file work without it displaying properties or methods?
Thank you
  댓글 수: 2
Christopher McClellan
Christopher McClellan 2016년 5월 12일
Did you ever solve this? I'm having the same issue. I can create a "dummy" library that I CAN call from Matlab, but I'm having the same problem you are with the real library that I need to call.
Christopher McClellan
Christopher McClellan 2016년 5월 13일
Never-mind. I had a typo in the namespace of my class library. That was a terribly embarrassing time suck...

댓글을 달려면 로그인하십시오.

답변 (1개)

Robert Snoeberger
Robert Snoeberger 2016년 5월 13일
Based on the result of color.Classes, the class name is EvolutionMaps.ColorMap. The correct way to call properties is,
properties EvolutionMaps.ColorMap

카테고리

Help CenterFile Exchange에서 Getting Started with Microsoft .NET에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by