Loading Files into Codegen Files
Mostrar comentarios más antiguos
Is there any good way to load data from files (hopefully MAT-files) into a Matlab function that will be going through the Matlab coder? I've been looking into using a bunch of coder.eval calls into the C MAT-file library, but it looks like this process is going to be exceedingly painful and I'm not entirely sure it will let me return arrays anyway, since ceval can only return Scalars...
Any ideas?
1 comentario
Carlos Pereira
el 9 de Mayo de 2016
Editada: Carlos Pereira
el 9 de Mayo de 2016
Dear friends,
I have a quite similar problem. Using MATLAB coder I want to convert a matlab function to mex file. Furthermore, on this function I called a matrix (2001x2 double) from a MAT file. I´m not getting a way to make it. With the "testReadMAT" I can´t call the matrix from .MAT in "X". I think you had the same problem and, if it´s possible, help me for fix it.
I´m looking forward for answers from any users!!!!
Respuesta aceptada
Más respuestas (3)
Greg
el 28 de Abr. de 2012
0 votos
1 comentario
Kaustubha Govind
el 30 de Abr. de 2012
The location of mat.h is $matlabroot/extern/include/mat.h, so you need to make sure that "C:\Program Files\MATLAB\R2012\extern\include\mat.h" exists and add it using a #include statement. That is, under "Header File" add #include "mat.h" and under "Include Directories", add the path.
1 1
el 25 de Nov. de 2013
0 votos
Hi Kaustubha, can you please explain how i can use coder to return matrix, i tried to use your trick mentioned above without success. Thanks in advance. Avi
Ryan Livingston
el 26 de Nov. de 2013
0 votos
The function coder.load is now supported which loads data from a MAT file at compile-time as constants:
The syntax is basically the same as LOAD in MATLAB.
Also, LOAD is now supported in MEX. Search for load here for more details:
Categorías
Más información sobre Algorithm Design Basics en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!