How to insert calculation values in to a zero matrix

Dr is the result matrix (4 by 4) and I want to insert only the third non-zero column into a new matrix like Z.
Dr =
0 0 -0.0618 0
0 0 -0.0618 0
0 0 0.9884 0
0 0 0.9884 0
Z = [-0.0618;-0.0618;0.9884;0.9884]
I've been tried a lot of ways but none of them works. Therefore, any advises are very welcome. Thanks!

답변 (1개)

Alan Stevens
Alan Stevens 2020년 8월 28일
Z = Dr(:,3)
should do it.

댓글 수: 3

It worked perfectly. Thank you so much, Alan!!!!!!
i suggest you to do the MATLAB Onramp Course.
Will do. Thanks

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

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

태그

질문:

2020년 8월 28일

댓글:

2020년 8월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by