Compare data sets of different length and make them equal

4 次查看(过去 30 天)
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

采纳的回答

Stephen23
Stephen23 2020-8-12
>> 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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by