Background
I am used to strongly typed, compiled languages so I'm used to misspellings being pretty much instantly picked up as undeclared variables.
However since Matlab is a weakly typed language this doesn't happen automatically and my development cycle tends to be:
write function(s)
|
˅
Run <-------------------------
| |
˅ |
Crash due to misspelling/typo |
| |
˅ |
Correct typo -----------------|
The run process can run for several minutes before getting to the typo, which slows down my development cycle considerably.
I'm using matlab version 2007b
Question
Is there any way to validate a function such that the use of non-existent variables etc are picked up without having to run the whole program? Given that each function has its own variable space it feels like this should be possible.
I am aware that is it possible to get a list of dependencies using depfun however I've not been able to find any way to validate those functions.
For example the following function will always fail but produces no warnings until it is run
function [biggest]=getBiggest(variableName1, variableName2)
if variablename1>variableName2, %<---misspelling!
biggest=variableName1;
else
biggest=variableName2;
end
end