Open file command in Matlab DLL

2 visualizzazioni (ultimi 30 giorni)
JayZ
JayZ il 10 Dic 2014
Commentato: JayZ il 11 Dic 2014
Hi Everyone,
I am struggling with building a dll for my m-files.
In particular: In one of my functions I am passing a file path to my dll and I want to receive data back in return which is the output of my dll.
While this sounds very well in theory, it appears that whenever I try to compile the executable I receive an error message about "extrinsic functions" could not be compiled in a standalone. (this is important for me as there is no matlab installed on the later application pc - mrt engine naturally is)
I tried to re-program my code with basic file operation functions but it appears that is not allowed to create a dll which reads data from a file.
Am I missing something? Does anyone know if the file open command is possible from a matlab dll?
I would highly appreciate your input on this.

Risposta accettata

Ryan Livingston
Ryan Livingston il 10 Dic 2014
Modificato: Ryan Livingston il 11 Dic 2014
It sounds like you are using MATLAB Coder ("extrinsic functions" makes me think so) to generate C code, is that true? If so, you should be able to use FOPEN,FREAD,FCLOSE in your MATLAB code from which you are generating code.
Code generation support for FREAD was added in R2014a and FOPEN and FCLOSE were added for code generation in R2013a:
If those are unavailable or insufficient you can see the answer:
that shows how to read in a space-delimited file of doubles in standalone code for an example of using coder.ceval to call the C runtime I/O functions.
  1 Commento
JayZ
JayZ il 11 Dic 2014
Hi Ryan,
Thank you very much for your quick reply.
Indeed, I am using the Matlab Coder and I am using R2013a, which allows me to use FOPEN and FCLOSE but only in writing mode.
The reason why I try to open a file from my dll was to avoid writing wrapper functions for variable array sizes for the dll inputs. But it looks like there is no way around this.
Thanks again for your help.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su MATLAB Coder in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by