MATLAB: Matrix Input

inputmatrix array

I need to get a Matrix from input with known size. for example a 3*3 or 2*2 matrix. i could not do it with 'input'.
thank you.

Best Answer

You can either save the matrix into a variable and then pass that variable to input, or write matrix at the prompt using delimiter ; instead of enter.
For example
>> b = eye(3);
>> input('get matrix: ')
>> % input b at the prompt
or
>> input('get matrix: ')
>> % input [1 0;0 1] at the prompt