필터 지우기
필터 지우기

Contents in a Vector

조회 수: 4 (최근 30일)
Anne Nguyen
Anne Nguyen 2019년 9월 26일
답변: Mahesh Taparia 2019년 9월 30일
Consider the following matrix.
A= 13 10 7
1 5 9
5 15 25
How do I 1. Write the contents of the element in the last row, third column to variable m1 and print m1? 2. Write the contents of the entire third column to vector m2 and print m2? 3. Write the contents of the second and third rows to matrix m3 and print m3?
  댓글 수: 1
Adam Danz
Adam Danz 2019년 9월 26일
Give this page about 10 minutes of reading and you'll not only answer those questions but you'll understand the basics of matlab indexing.

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

답변 (1개)

Mahesh Taparia
Mahesh Taparia 2019년 9월 30일
Hi
You can run the following command to access and display the array elements which you have asked. The solution is as per your question number:
1.
m1=(A(end,3));
disp(m1)
2.
m2=(A(:,3));
disp(m2)
3.
m3=(A(2:3,:));
disp(m3)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by