MATLAB Answers

how to imput a matrix end outpur four arguments

1 view (last 30 days)
ANDREA SGHEDONI
ANDREA SGHEDONI on 3 May 2020
How can i create a function that has an imput a matrix arguments and in outputs four arguments, the corner's matrix

  0 Comments

Sign in to comment.

Answers (1)

Thiago Henrique Gomes Lobato
The main function creation in matlab has the following form:
function output = FuncName(input)
output = f(input)
end
Input can be a matrix, and, in your case, the function is to get the corners, which can be done with simple index. So:
function output = FuncName(input)
%Up-Left %Up-right %Bottom-left %Bottom-right
output = [input(1,1), input(1, end); input(end, 1),input(end,end) ];
end

  0 Comments

Sign in to comment.