Hi,
I want to compare each element of matrix with 'total 'and check if it is equal.
Code gives error. How can I do that please?
clc
clear
b=[2 2]
t=[1 1 ; 1 1]
total=2;
for v=1:b(1)
rowsum(v,1)=sum(t(v,:));
end
for y=1:b(2)
colsum(v,1)=sum(t(:,v));
end
if rowsum(:,1)==total && colsum(:,1)==total
disp 'yes'
end
Best Answer