While Loop Array Javascript Append Function Matlab Example Problems