How do I make two vectors of different length equal in length

3 views (last 30 days)
How do I make the length of the two vectors equal according to the length of the shortest vector, ie, delete the values at the end??
A=[1 2 3 4 5 6 7 8]
B=[5 6 8 1 2 3 7 4 55 66 88]
The result
A=[1 2 3 4 5 6 7 8]
B=[5 6 8 1 2 3 7 4 ]

Accepted Answer

KSSV
KSSV on 25 Sep 2021
A=[1 2 3 4 5 6 7 8]
A = 1×8
1 2 3 4 5 6 7 8
B=[5 6 8 1 2 3 7 4 55 66 88] ;
B = B(1:length(A))
B = 1×8
5 6 8 1 2 3 7 4

More Answers (0)

Categories

Find more on Statistics and Machine Learning Toolbox 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!