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