This is not a good programming example. The "clear all" is useless here and removing all loaded fucntions from the memory is a waste of time and energy. Even the less brute "clear variables" cannot be recommended here: Better check you code, if all uses variables are defined. If they are, the unconditional clearing is inefficient.
Does "nos" mean "numbers"?
Do you see, that "a" is underlined by MLint? This means, that MATLAB found out, that this command is inefficient, because you do not pre-allocate "a". Just hold the mouse over the underlined symbol to learn more about MLint.
The sorting algorithm is inefficient, but the implementation is not clean: There is no reason to run the FOR loop over i until 5.
It would be much nicer, if the data length is not fixed to 5, but can be changed by the user through an input. I'd prefer to convert this to a function, instead of a script.
29 Sep 2011
I have updated the Script file to a Function called 'Array_sort'. Which is more user input oriented, with a variable size of array.
Upon calling this function in matlab command window it will ask for the user input data.