필터 지우기
필터 지우기

Why can't i input matrices other than square matrix in MATLAB 16B and 17A??

조회 수: 1 (최근 30일)
Shivam Upadhyaya
Shivam Upadhyaya 2017년 4월 8일
댓글: Stephen23 2017년 4월 8일
Like when i input A=[1,2,3;4,5] MATLAB is not assigning this to variable A
  댓글 수: 1
Stephen23
Stephen23 2017년 4월 8일
The name MATLAB stands for MATrix LABoratory, and by the standard mathematical definition matrices must have an element in every location, i.e. not contain any holes. The shape you are trying to define contains holes, i.e. not all elements are defined. Ergo it is not a matrix, and will throw an error. This is the expected and correct behavior.

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

답변 (1개)

Star Strider
Star Strider 2017년 4월 8일
You have 3 elements in ‘A(1,:)’ and 2 in ‘A(2,:)’. That is not permitted in double arrays.
Empty elements in cell arrays are allowed:
A = {1,2,3; 4,5,[]};
However, calculating with such arrays as double arrays remain as not permitted. Fill the ‘empty’ element with NaN if you must, although it will likely result in NaN results of calculations with that matrix.

카테고리

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