Info
此问题已关闭。 请重新打开它进行编辑或回答。
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 次查看(过去 30 天)
显示 更早的评论
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
1 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!