Transfer pointer from matlab to external c function
Mostrar comentarios más antiguos
Hello, so I'm going to expose the situation in details to avoid misunderstanding: I'm working on a signal processing algorithm, which is (already) written in MatLab. For performance reasons, the program to collect the raw data from the measuring device must be written in C. Therefore, I must transfer about 1Gb of raw data from a C function to the matlab program. The only efficient way of doing so I could think of was:
- to send the memory address (e.g. hexadecimal form) of a matlab variable to the c function as an argument (using 'system') -the c functions collects then writes the data at this address -then matlab uses this variable since the data has been written at this address
However I couldn't find a way to obtain the address of the matlab variable to then transfer it. I tried using 'format debug' but it only displays the address and I can't load it to a string.
So if you have a way to get a variable's memory address or another way of efficiently transferring large amount of datas from a .exe to a matlab program, that would help a lot!
p.s: I already tried to output the data using the 'system' function, and also to write it on a file on the hard drive, but in both cases, it's much too slow :(
Thanks!
2 comentarios
dpb
el 25 de Nov. de 2016
Even if you had that address, it wouldn't be of any use because the two processes are in different memory spaces.
This kind of thing is what the external interface API is for...start your exploration at <Advanced Software Development>. You're interested in the External Functions and API sections in particular.
James Tursa
el 29 de Nov. de 2016
+1 dpb
Respuestas (1)
Walter Roberson
el 29 de Nov. de 2016
0 votos
Categorías
Más información sobre External Language Interfaces en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!