How to pick a value inside of a .mat file?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hasan Kaan Tuna
el 21 de Jul. de 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 comentarios
Stephen23
el 23 de Jul. de 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.
Respuesta aceptada
Pratyush
el 25 de Jul. de 2023
Editada: Pratyush
el 25 de Jul. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!