How to best print output to command window during a loop in Matlab?
Check the fprintf. You can format your output just like you want. The error function will stop code execution. The display function only prints the value of the variable, without printing the variable name.