Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

I am trying to write a matlab function that that takes a matrix as input and test if that matrix is a square(using a sub-function) and if it is a square it must test if it meets a certain condition. Here is my code

2 visualizaciones (últimos 30 días)
function [a,b] = matr(A)
[a,b]=size(A)
d=diag(A)
S=sum(d==0)
Results = tests(a,b)
if S>0.5*length(d)
RT1=1
disp('The matrix is a Romanov type 1.\n')
else
RT1=0
disp('The matrix is not Ramanov type 1.\n')
end
end
function test = tests(a,b)
if a==b
d=diag(A);
S = sum(d==0)
disp('The matrix is a square matrix.\n')
end
end

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by