Variables from a .mat file, loaded with "coder.load" in a mex-file, remain equal when I change the value of the content of the mat.file
4 views (last 30 days)
Show older comments
Hi everyone!
This is my first time asking a question, so I hope I can give you a good description of my problem so someone can help me.
I have created a mex file from a .m.
The mexfile read a couple of variables from a .mat file using the function coder.load('name.mat') :
DatosInput = coder.load('name');
m_est = DatosInput.mest;
R_est = DatosInput.rs;
L_est_disper = DatosInput.lls;
L_est_mag_1 = DatosInput.lm;
m_rot = DatosInput.m_rot;
R_rot = DatosInput.rpr;
L_rot_disper = DatosInput.mest;
Par_resistenteValor =DatosInput.Tres;
J_inercia = DatosInput.J;
p = DatosInput.p;
fmostens = DatosInput.fmostens;
tfinal = DatosInput.tfinal;
U_aux = DatosInput.U_linea;
The thing is that the value of the variables stored in "name.mat" are not always the same (in size and value), because externaly everytime a different .mat file is generated, however, the amount of variables are always the same.
The problem is that, once I compile the mex-file using MATLAB Coder and change the original values of the name.mat, the mexfile continue operating with the original values which with the mex-file was created during the compiling.
Thank you very much.
8 Comments
dpb
on 23 May 2019
After re-reading the documentation link, I see now that is indeed the documented bethavior.
It's not totally clear that's what they mean I think on first reading because one just doesn't really expect that kind of behavior for a function with the name and the way the regular load function works.
To do so at run time will take a different route--not sure what can be used in the environment you're working in, though, for specifics.
Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!