MATLAB: Matlab editor: the function might be unused

global variablematlab function

Below is the body of my code.It keeps saying that func2 might be unused.I'm not sure how to fix this…

Best Answer

Hi,
the easiest way is to make two files: one for func1 and one for func2. (I don't know if you can fix this problem using only one file.) In the file for func2 you have to add the Global-definition for G.
The file names must be the same as the function names.