From the documentation:
"Passing -I on the Command Line:
You can use the -I option to add a folder to the beginning of the list of paths to
use for the current compilation. This feature is useful when you are compiling
files that are in folders currently not on the MATLAB path."
So after -I I think you should pass the path to the directory containing otherfunction.m, NOT the path of otherfunction.m itself.
A few other things to check:
Use which otherfunction to ensure you're using the right version of otherfunction (if multiple versions exist). If two functions on the path have the same name, Matlab silently defaults to whichever is higher on the path.
If the code you are compiling calls a function using eval, then you will need to supply the directory containing that function (or supply the function explicitly), even if that directory is on the matlab path.
If all else fails, try using the GUI for the compiler instead of the mcc command. To bring up the GUI, simply type deploytool in the command window. Once you've chosen a project location in the GUI and specified a "console application" (or whatever else you want), then you click on the link "add main file" and add myfunction.m. Then look for the link "add other references/folders" (or something similar), click it, and then manually add the directory(s) containing otherfuncion.m and secondfunction.m.