Call an external ActiveX method by reference

7 vues (au cours des 30 derniers jours)
Christian Lenz
Christian Lenz le 17 Juil 2012
Hi everybody
In my Matlab code I'd like to use an exernal ocx-file as API that is provided by the manufacturer of my measurement equipment. This provides an ActiveX user interface that allows to extract data from their system specific data files.
Within my code I initialize a COM server:
VTR = actxserver('vxaebas.VallenTRFileX');
This works fine. I can then read the file properties via the provided methods. E.g. get the ActiveX version by
disp( ['ActX Version',num2str(VTR.GetVersionInfoString)] );
I like to use the following method to extract the measured data:
VTR.OpenFile([filePath,fileName]); % works fine
RetCode = VTR.SeekAndRead(SetNo,OffsetSamples,SamplesToRead,DataArray);
The variables are: - RetCode: bool, 1=success, 0=nope
- SetNo: longint, the dataset to be extracted
- OffsetSamples: longint, starting point for reading data in specified set
- SamplesToRead: longint, number of samples to be read into buffer
- DataArray: OleVariant, Holds TR data and each entry is of type smallint
This method somehow opens the file and I'm able to read the sets specifics (e.g. the sampling rate at which it was recorded). But the function does not write on "DataArray". I need somehow to call-by-reference. So I tried to write my own data class for this, didn't work...
Is there any good trick?
Thanks a lot!
Best, Chris
  1 commentaire
Alireza
Alireza le 5 Août 2012
Hi Christ, I have exactly the same problem by S7 plcsim. I can conect to dll activex server and perform most of methods but the methods that need puting data in an array (like this one): ReadOutputImage(int32, int32, data_type_constant,Variant(pointer)) I have used every possible thing that I guessed may work, but the method do not return data of specified memory area. (arrays, cell arrays, libpointer, ...)
Have you reached any conclusion on your problem?
Best regards

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by