Clear out the old values of x from the previous exercise, by doing >> clear x To iterate, use x(end+1) instead of explicit numerical indices. Then you can can just copy-and-paste your assignment statement 50 times.