MATLAB Answers

0

How to load microsoft access table shortcuts that is compatible with Matlab Coder

Asked by Matthew Flanagan on 2 Aug 2018
Latest activity Answered by Ryan Livingston on 16 Aug 2018
I am working with a Matlab function that loads a Microsoft access table shortcut and then processes the data accordingly. When I try to use the Matlab coder to convert to C code it fails because it can't convert the load function to an equivalent in C.
So my question is, is there a workaround to open a Microsoft access table shortcut without the function load so I can use the Matlab coder?
I have looked into opening it manually with C, however I don't have access to the entire data set just the shortcut so I can't view the contents of the file and thus how to load it in C.
________________________
Debugging Info
I can generate a MEX file successfully with Matlab coder using the load function since it is supported. Attached is an output of the error message after trying to generate code. Additionally I have tried open, fopen, and coder.load. The problem with fopen is that it doesn't know how to read it properly. Open works but is not supported by Matlab Coder. As for coder.load it doesn't work when generating code either.
Thanks for any help!

  3 Comments

Just for clarification: the .mat extension is used by Matlab to store variables in a file, and by Microsoft Access to store something else. In this case it is clearly the former. You could store the contents of the variables in a text format so you can read it with fopen and fread.
Yes it is a Microsoft access table and not a Matlab file. Unfortunately, for my project getting another file format is not possible (I have asked).
I'm not aware that the load function is capable of reading those. You might need to use ActiveX controls, which would massively decrease your chances of converting to C.

Sign in to comment.

1 Answer

Answer by Ryan Livingston on 16 Aug 2018

There's no explicit MATLAB Coder support for loading these types of files. Are you trying to generate MEX code to speed up your MATLAB code or do you eventually want C code to use outside of MATLAB?
For MEX, I'd suggest starting with finding a way to read those files in MATLAB first. Once that works, use the MATLAB profiler to measure your MATLAB code and focus on generating MEX for the hot spots. Then you can run your Microsoft Access code in MATLAB, and the performance critical algorithmic code in generated MEX.
For standalone code, if you can write C code to read the data from the table, you can call that C code from your MATLAB codegen code using coder.ceval to import the data.

  0 Comments

Sign in to comment.