How to load a mat file in mex with input string as file path?

2 visualizzazioni (ultimi 30 giorni)
I'm writing a C code for Mex where in I have to load about 1000 mat files. The names of mat files are stored in cell array in another mat file. The input to the main function has the path from where I have to load this cell array mat file and then later iteratively I have to load each of the 1000 mat files which are saved in the same path. How do I load the mat file when I have the path as a char variable in Mex. So far this is my code: -
char *srcpath;
srcpath = mxCalloc( ((mxGetM(prhs[2]) * mxGetN(prhs[2])) + 1), sizeof(char));
mxGetString(prhs[0], Type, ((mxGetM(prhs[0]) * mxGetN(prhs[0])) + 1));
How do I proceed further? Like how can I do
load([srcpath,'datainfo.mat']);
  2 Commenti
Jan
Jan il 27 Ott 2014
Do you really have to do this in C? It is so much easier in Matlab.
Hariprasad
Hariprasad il 27 Ott 2014
Modificato: Hariprasad il 27 Ott 2014
This is just the start of my code. The 1000 mat files have loads of data in them which undergo a lot of processing hence I'm using mex. Its the concatenation of srcpath and 'datainfo.mat' that has kept me holding.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Write C Functions Callable from MATLAB (MEX Files) 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