A matrix with the elements 2 and 3 "every row of A matrix contains at least one element with the value 2 then the system has a solution, otherwise system has no solution.
clc
clear
close
//given matrix with entries 2,3
m_matrix = [2 3 3 3;2 3 2 3;2 2 2 3;3 3 3 3;]
disp(m_matrix)
//get it's row and column
m_size = size(m_matrix)
m_rows = m_size(1)
for i = 1:m_rows
//get each row
r = m_matrix(i,:);
//find no of 2's
flag = 1
tows = find(r==2);
if isempty(tows) then
flag = 0
break;
end
end
if flag then
disp("System has solution..")
else
disp("System has no solution..")
end
Please loging to post comment