MATLAB: MATLAB Editor Code Analyzer

code analyzereditor

For the following code
x=1;
save('x','x')
x=2;
the MATLAB Editor Code Analyzer warns
"The value assigned to variable 'x' might be unused." I have clearly used it; I saved it to the file 'x.mat'. This bugs me, I'd like to see a nice green box telling me my code is clean.

Best Answer

Add the %#ok pragma at the end of the line:
x = 2; %#ok
HTH.