use getValid instead of deprecated matlab isvalid