I have created a function in Matlab and use the following run.m file to run it.
global kanasta EEG_multitaper_autocor_SO_maheen_final(ALLEEG_LANCE_POST, All , Cz-CPz ,3,1,1,1) POST=kanasta;
where kanasta is a variable generated from the function EEG_multitaper_autocor_SO_maheen_final and ALLEEG_LANCE_POST is a data structure.
From whatever kanasta (which is an array) I get from running this, I store it in POST as shown.
Then I change the code so that I run the following:
global kanasta EEG_multitaper_autocor_SO_maheen_final(ALLEEG_LANCE_PRE, All , Cz-CPz ,3,1,1,1) PRE=kanasta;
where I am using ALLEEG_LANCE_PRE is also a data structure with the same structure but just different data, everything else is exactly the same as ALLEEG_LANCE_POST.
I find that when I do this, there is some pre-stored version of kanasta that is incorrect and both PRE and POST turn out to be exactly the same thing. I am guessing its some sort of problem with the global kanasta which is declared global in my run.m file as well as the function as well. I am not sure why this is happening (it was fine before... my Matlab crashed last night and after that this has happened). And its messing up any further analysis I need to do on PRE and POST. I have also tried to save PRE to another variable and then running the code for POST and saving that, but it doesn t seem to work. I have cleared the workspace multiple times and cleared all variables and command history and restarted, but nothing works.
Does anybody have any advice on "resetting" perhaps? Or about global variables or why this might be happening?