So basically I need to write a function that makes an mxn martix where the elements are multiples of 7 (7,14,21,…), also m =/= n and they are user inputted positive integers. This is what I have so far:
function [] = matrixQ3(m, n)
prompt='Enter a positive integer for m: ';
m = input(prompt);
prompt1='Enter a positive integer for n that is not equal to the first: ';
n = input(prompt1);
x=0;
while x == 0;
prompt='Enter a new positive integer for m that is not equal to n: '; m = input(prompt); prompt1='Enter a new positive integer for n that is not equal to m: '; n = input(prompt1); if m ~= n && m > 0 && n > 0; x=1; endend %z = m * n;
%mat = [m:n, ];
%disp(mat)
end
I am having trouble figuring out how to do the elements part of the matrix.
Best Answer