Gistlib Logo

gistlib

write an matlab function that will take a (4 × 4) matrix as an input argument, and will average the values of each row, inputting the found values on the main diagonal of the matrix. in matlab

main.m
function avgValues = averageRowsToDiagonal(matrix)
    avgValues = diag(mean(matrix, 2));
end
94 chars
4 lines

similar matlab code snippets

create a function that gets the average of a 2x3 matrix in matlab
function to covert mnist to mat in matlab
how to calculate the mean of a matrix in matlab
design a function that runs a every digit from a matrox in matlab
design the function function out = x_m(x,m) with input data matrix x of size 𝑁 × 𝑑 in matlab
finding maximum number in a row in matlab
how to calculate the standard deviation of a matrix in matlab
how to calculate the mode of a matrix in matlab
how to calculate the variance of a matrix in matlab
how to calculate the median of a matrix in matlab

related categories

matlab
matrix
function

gistlibby LogSnag