Calling .mat file into function
Afficher commentaires plus anciens
Hi I have a question about calling contents of a .mat file into function. for example you save some matrices into .mat file and now you want to calling them into function.
How can do it please?
Réponses (2)
Geoff Hayes
le 9 Déc 2014
Modifié(e) : Geoff Hayes
le 9 Déc 2014
0 votes
2 commentaires
fatema saba
le 9 Déc 2014
Geoff Hayes
le 9 Déc 2014
Fatema - I don't understand what you mean by it is needed to load my .mat file from command window before. Why not assign, in your function, the result of the load to a structure as
data = load('test.mat');
And, what is the purpose of the evalin call?
Pablo Díez
le 21 Mar 2020
0 votes
You can extract the variable which you want from the model workspace doing the following in a Matlab Function block:
coder.extrinsic('get_param','getVariable');
mdlWks = get_param('your_model.slx','ModelWorkspace');
variable= getVariable(mdlWks,'variable_name');
Catégories
En savoir plus sur Workspace Variables and MAT Files dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!