How to pick a value inside of a .mat file?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hasan Kaan Tuna
le 21 Juil 2023
Modifié(e) : Pratyush
le 25 Juil 2023
Hey all,
I have .mat file that contains 14k double variables and their values. Also, I have a workspace that contains some of those signals and more. I want to change values of the workspace variables with the ones in the .mat file. So, how can I check if my workspace has a copy of the singal in the .mat file and change its value? And, apply it for all 14k variables respectively?
Thanks.
5 commentaires
Stephen23
le 23 Juil 2023
"Can I use ismember like: ismember(MatFileWith14kVariables, ws) ? In this example ws stands for workspace."
I see nothing in the ISMEMBER documentation to suggest that it supports a "workspace" as an input argument (whatever that means). The ISMEMBER documentation states what input arguments it supports:
But given that the word "workspace" has a very specific meaning in MATLAB:
which contradicts your explanation given here, we can only conclude that either your explanations are inaccurate or you are using standard terms to mean other things. That makes it very hard for us to help you.
Réponse acceptée
Pratyush
le 25 Juil 2023
Modifié(e) : Pratyush
le 25 Juil 2023
Hi Hasan,
I understand that you have some variables defined in the workspace and you want to update the variables from thier value stored in a .mat file. You only want to update those variables of your workspace which are present in your .mat file. You can use "load" function to do this. Use the following command.
% make an array of variables in your workspace
varNames = who;
% Load the specific variables from the .mat file
load('your_file.mat', varNames{:});
This would update the variables of your workspace with their value present in the .mat file and leave the variables that are not present in the .mat file unmodified.Refer to the documentation for more detail: Load variables from file into workspace.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!