When calling a function or indexing a variable, use parentheses.
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello I am trying to solve this but I need some help to make it work. Kinda new working around matlab. your help would be totally appreciated. Thank you.
댓글 수: 0
답변 (2개)
DGM
2023년 11월 20일
The error message tells you what to do. diag() is a function; [1 2 3] is a vector, so:
diag([1 2 3])
댓글 수: 0
Walter Roberson
2023년 11월 20일
The syntax for calling functions is function name followed by ( followed by a list of parameters followed by )
You are trying to use diag[Expressions] -- which would be the kind of calling syntax that Mathematica would use, but not MATLAB.
Use diag([Expressions]) instead.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!