Compare data sets of different length and make them equal
4 次查看(过去 30 天)
显示 更早的评论
Ramkumar Ganesan Rajalekshmi
2020-8-12
评论: Ramkumar Ganesan Rajalekshmi
2020-8-12
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
0 个评论
采纳的回答
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 Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!