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!