how can i ask the user for 2*2 matrix
조회 수: 1 (최근 30일)
이전 댓글 표시
I am trying to let the user enter input in matrix form
matr = input ('enter values in matrix form [a,b; c,d]');
but how can I make sure that the user input 2 columns only but whatver rows. I am new to manipulating array and matrix.
댓글 수: 0
답변 (1개)
madhan ravi
2019년 4월 21일
편집: madhan ravi
2019년 4월 21일
if size(matr,2)>2
disp('Has more than 2 Columns beware!')
end
댓글 수: 2
madhan ravi
2019년 4월 21일
matr represents the input matrix data and 2 represents the number of columns , reading the documentation of size() will clear things for you.
doc size % in command window
help size
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!