Clear Filters
Clear Filters

How to put elements of a matrix into another matrix.

4 views (last 30 days)
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!

Accepted Answer

Stephen23
Stephen23 on 21 Apr 2018
Edited: Stephen23 on 21 Apr 2018

Where M is your matrix:

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

or

tmp = M(2:4,3:4).';
tmp(:)

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!