Do not use
warning off; clear all; close all; clc;
because clear all removes all loaded function from the RAM and reloading the files from the slow hard disk wastes a lot of time.
Calling WMIC through system is time consuming also and as far as I cen see, this is applied to the same Matlab session all the time.
Matlab's JIT acceleration works only for lines, which contain one command. At least this was the situation in the time, when this feature was documented. Although modern Matlab versions might not suffer from this limitation, having one command per line only improves the readability.
If you are sure, that all variables are pre-allocated properly, then I do not have more general methods. Use the profiler to find the bottleneck of the code, because it is not worth to optimize a line, which takes 0.1% of the processing time only: you can reduce the runtime by 0.1% only, if you can accelerate this line by a factor of even Infinity.