Create a vector from components of old vectors
6 views (last 30 days)
Show older comments
I have a 3x5 matrix, I want to be able to take the 1st row and the 3rd column to create a row vector. I know how to seperately extract a row and a column, but how would I go about using that in order to create a new vector without typing individual elements?
2 Comments
Accepted Answer
Tommy
on 16 Apr 2020
For a matrix A such as
A = rand(3,5);
this should work:
v = [A(1,:) A(:,3)']
0 Comments
More Answers (0)
See Also
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!