Compare data sets of different length and make them equal

4 views (last 30 days)
Hello all,
I want to compare two data sets and make them equal by length, by eliminating one or two values from the higher length data.
Data_1 = [1, 8 , 10, 11, 24, 30] ; % data length is 6
Data_2 = [2, 4, 5, 21, 9, 7, 1, 3]; % data length is 8
Now i need to delete the last two values from Data_2 so that Data_1 and Data_2 colud be of equal length.
Result must look something like this,
Data_2 = [2, 4, 5, 21, 9, 7]
Is there any method to implement this?
I would really appreciate it if anyone can help me out. Because I am a beginner in MATLAB.
Thanks and Regards,
Ram

Accepted Answer

Stephen23
Stephen23 on 12 Aug 2020
>> Data_1 = [1, 8 , 10, 11, 24, 30];
>> Data_2 = [2, 4, 5, 21, 9, 7, 1, 3];
>> Data_2(1+numel(Data_1):end) = []
Data_2 =
2 4 5 21 9 7

More Answers (0)

Tags

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!