Info

This question is closed. Reopen it to edit or answer.

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 views (last 30 days)
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

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!