MATLAB: Help with for loops

for loopsMATLAB

Trying to create a program that asks user to input a number (integer) and then generates a list of randomly generated numbers (integers) between ‘1’ and number that user entered. Their should not be any repetition of numbers in the list.
I have this so far and I can't seem to figure out how to not repeat the #'s and to display the inputted integer. I know I have to use a if command but don't know how to execute! I have attempted to use if and else statements but I am stuck.
clc;
x = input('Enter a integer: ');
for x=1:x,
k=round(rand*x);
fprintf('%d\n',k)
end
Any Help is most appreciated.

Best Answer

x = input('Enter your number\n');
randperm(x)