필터 지우기
필터 지우기

how can i ask the user for 2*2 matrix

조회 수: 1 (최근 30일)
mat geek
mat geek 2019년 4월 21일
댓글: madhan ravi 2019년 4월 21일
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.

답변 (1개)

madhan ravi
madhan ravi 2019년 4월 21일
편집: madhan ravi 2019년 4월 21일
if size(matr,2)>2
disp('Has more than 2 Columns beware!')
end
  댓글 수: 2
mat geek
mat geek 2019년 4월 21일
thank you. Can you explain what are the arguments for the size?
madhan ravi
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 CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by