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.

 채택된 답변

Honglei Chen
Honglei Chen 2012년 3월 6일

0 개 추천

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

댓글 수: 1

Babak
Babak 2012년 3월 6일
it is not what i wanted.
i want to get an input matrix from user.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2012년 3월 6일

0 개 추천

There is no MATLAB command for getting a matrix of a known size. You can program it through repeated calls to input()

댓글 수: 3

Babak
Babak 2012년 3월 6일
you mean that the only way of getting a matrix from user is to use 'input' ?
Jan
Jan 2012년 3월 6일
A uitable would be fine also.
Babak
Babak 2012년 3월 6일
can you explain more?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

질문:

2012년 3월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by