Here are the 5 steps you need to take. Since this is your assignment, this answer isn't complete. Each step shows what you need to do in that step but you need to adjust it to your needs. Please feel free to leave a comment if you get stuck.
n = 8;
dvec = regexprep(num2str(1/12, sprintf('%%.%df', n)),'^\d+.', '');
nv = str2double(num2cell('12345'));
isOdd = mod([9 8 7 6 5], 2);
oddEven = {'Odd','Even'};
logicalVector = [true true false true false false false];
out = oddEven(~logicalVector+1)
Update: Return a random char array: Even or Odd
after further clarification in the comments below, this is the function you're looking for. The function does not have any inputs. Just call toss() and it will return the character array "EVEN" or "ODD"
function y = toss()
options = {'EVEN','ODD'};
y = options{randi([1,2],1)};
fprintf('%s\n',y)
Example
Alternatively, the first input could be a positive integer that determines the number of random "even" "odd" outputs.
function y = toss(x)
options = {'EVEN','ODD'};
y = options(randi([1,2],1,x));
disp(y)
Best Answer