a=[1 0 0 0 0;0 1 0 0 0;0 0 1 0 0;0 0 0 1 0;0 0 0 0 1]function y_diagonal =replace_NaN(x)y=x;end
MATLAB: Replace the diagonal with NaN in this 5×5 matrix
indexingMATLABmatlab codermatrix manipulation
indexingMATLABmatlab codermatrix manipulation
a=[1 0 0 0 0;0 1 0 0 0;0 0 1 0 0;0 0 0 1 0;0 0 0 0 1]function y_diagonal =replace_NaN(x)y=x;end
Best Answer