Why is there aditional data loaded

I have an issue where when I try to load data, another set of data is loaded and vectors are drawn from it immedeaty.
I've made a seperate script to test why it happens and I can't figure it out. the script is no longer than what I post here. I load data the following way:
close all
clear all
clc
%% seperate to close and load seperately.
load('TEST1_5_5_5randomdrive.mat')
%% this is the end of the test script
Right after I load TEST1_5_5_5randomdrive.mat, the 25351,1 double, another data file (Test213221filter5) is loaded and from that ay, AY and all the other 808,1 doubles are drawn even though I did not ask for that in this script. the workspace looks like this after running the above script:
I have in other scripts. Those scripts are closed and the files I load into there are in seperate folders. In those scripts I make Q the data and draw all the vectors from that. But this script is literally close everything and load the data into the workspace and it does all the extra stuff.

Respuestas (1)

Stephen23
Stephen23 el 6 de Abr. de 2022
" But this script is literally close everything and load the data into the workspace and it does all the extra stuff."
No "extra stuff" is happening.
That mat file contains all of those variables. You can check the .mat file content using WHOS:
whos -file TEST1_5_5_5randomdrive.mat
Your code loads all of the variables from the mat file. Ergo, all of them will appear in the workspace. So far everything is working exactly as expected and documented.
Your code is not robust: you should always LOAD into an output variable (to avoid exactly the kind of issue that you are having now). When you do that, you will also be able to clearly see the loaded data in the output structure.
CLEAR ALL and CLOSE ALL are brutal examples of https://en.wikipedia.org/wiki/Anti-pattern code.

2 comentarios

Wouter Kamperman
Wouter Kamperman el 6 de Abr. de 2022
Thanks for anwering. The only reason I made it so short and crude is to find out why it was happening. But thanks for those tips as well.
I have saved the table I want to a different name.
Stephen23
Stephen23 el 6 de Abr. de 2022
"...to find out why it was happening"
You LOAD all of the .mat file data. That is what is happening.

Iniciar sesión para comentar.

Productos

Versión

R2018b

Etiquetas

Preguntada:

el 6 de Abr. de 2022

Comentada:

el 6 de Abr. de 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by