It stated an error "Error is 'reference to a cleared variable app."
Don't use clear all, neither clc in this and most of the cases.
if you call a function with input arguments, and within that function you execute clear all command, you are not able to use anything you sent, maybe even what's declared prior to entering the function.
Best Answer