MATLAB is changing variables when I do not want it to.
- by WVUstudent
Here is my problem in a small bit of code used as an example,
trial(0)
function [] = trial(test)
disp(test)
if(test == 1)
disp('test is one')
test = 0;
end
disp(test)
Matlab prints out this:
0
'test is one'
0
This is not my real code, there are over 500 lines of it, but this is a section of my code where the problem has risen. I have used the search function to see if I have been incrementing any variables anywhere, and have put in over 2 hours trying to see why MATLAB is changing my variables when I don't want it to.