필터 지우기
필터 지우기

How to put elements of a matrix into another matrix.

조회 수: 4 (최근 30일)
Darrian Low
Darrian Low 2018년 4월 21일
댓글: Darrian Low 2018년 4월 22일
Hi,
I am trying to extract six numbers from columns three and four in the photo below. The numbers I desire are 5600, 1500, 5500, 620, 5100 and 620.
The way I wish to format those numbers are in a 6x1 matrix. Just like the one below.
I am currently trying to use a for loop and an if loop, since I don't want the numbers 5025.026 and 1001.875 in my 6x1 matrix, but to no avail.
I look forward to seeing some of your answers and assistance. Thanks!

채택된 답변

Stephen23
Stephen23 2018년 4월 21일
편집: Stephen23 2018년 4월 21일

Where M is your matrix:

reshape(M(2:4,3:4).',[],1)

or

tmp = M(2:4,3:4).';
tmp(:)
  댓글 수: 1
Darrian Low
Darrian Low 2018년 4월 22일
Thank you very much for your help! I appreciate it a lot.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by