フィルターのクリア

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 Center および File ExchangeLogical についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by