how to get element of a matrix that defined as a function?
조회 수: 5 (최근 30일)
이전 댓글 표시
hi. suppose this matrix function. how can i get its elements ? for example ha(1,1) dosent work.
ha=@(J) [0 J;1 J];
댓글 수: 1
채택된 답변
Stephen23
2019년 12월 16일
That numeric matrix is only created when the function is called, it does not exist beforehand.
So you need to call the function, assign its output to a variable, and then use indexing:
M = ha(5)
M(1,1)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!