You should give full paths to read files really, especially when you compile a program as these will be in different locations and not on the Matlab path (which data folders shouldn't really be anyway).
doc ctfroot
can help you determine the correct location for a deployed app.
doc isdeployed
is also useful here to ensure you look for the file in the right place when it is deployed or not deployed.