What aspect doesn't work? What happens?
As an aside, don't put
clear all
clc
in a function. A function has its own workspace, there is nothing in it at the start of the function if no input arguments are passed in so 'clear all' does nothing (and even worse if there are input arguments it would instantly delete them).
clc also has no business being in a function whose purpose is to run some other code. A function should have a clear purpose and stick to that, without having side effects that someone calling the function doesn't expect it to. Obviously in this case you may be the only person ever using the function, it's just a comment related to general good design.