Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

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 vues (au cours des 30 derniers jours)
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

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by