In the first of those, you have at least warnings, as indicated by the orange color to the upper right of the area. The second of those shows green, indicating no warnings or errors. Possibly you need to fix the warnings.
I would also suggest experimenting with commenting out the
clear all; close all; clc
as "clear all" does a lot more than you might expect, and might be interferring with the parsing of the script.