Smallest of 3 arrays

조회 수: 4 (최근 30일)
Balint Egri
Balint Egri 2020년 10월 14일
댓글: Balint Egri 2020년 10월 14일
I have 3 array:
Acc_X: 1x1161 double,
Acc_Y: 1x1155 double,
Acc_Z: 1x1158 double,
I would like to choose the smallest of these 3 (like an if loop) and based on that remove the values from the other arrays. So in this case it will be 1x1155 for all 3.
For example remove the last 6 values from Acc_X
Anybody have a godd suggestion? THanks for the help :)))

채택된 답변

Walter Roberson
Walter Roberson 2020년 10월 14일
L = min([length(Acc_X), length(Acc_Y), length(Acc_Z)]);
Acc_X = Acc_X(1:L);
Acc_Y = Acc_Y(1:L);
Acc_Z = Acc_Z(1:L);
  댓글 수: 1
Balint Egri
Balint Egri 2020년 10월 14일
Works perfectly, thank you very much ;)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by