Just simply by being consistent in all of my code?
Yes this is the only way. Matlab or any other programming language does not know about units. They only know about numbers.
As an example consider incompressible flow. If you set your velocity in m/sec, length in meters (how you generate the grid), pressure in Newton/m^2, kinematic viscosity in m^2/sec, then the time would be in seconds.
You can build code which will respect units. E.g., openfoam does this. You must define your own data types and operations on them. Each data type should have an associated unit. The program should warn you if you try to add/subtract two variables of different units. Even then, it is your responsibility to set these variables with correct numerical values. Suppose v should be in m/sec and you have to set it to 1 m/sec. If you say 1 m/sec = 100 cm/sec and you set v = 100, then that would be wrong, and no program can detect such that mistake.