필터 지우기
필터 지우기

Calculating the differences of elements in an array

조회 수: 1 (최근 30일)
Jason
Jason 2023년 10월 2일
답변: David Hill 2023년 10월 2일
I have one file that has 7 clocks of 1x10000 doubles. To start, I need to figure out how to sort the time differences between one element in the array and all of the other elements.
I have the file loaded and I know how to use the sort() function but I don't know how to calculate all the time differences to one element.
Any help would be much appreciated

채택된 답변

Matt J
Matt J 2023년 10월 2일
tsorted = sort(t-t(1))

추가 답변 (1개)

David Hill
David Hill 2023년 10월 2일
x=rand(1,10)
x = 1×10
0.3223 0.4650 0.4962 0.5099 0.6174 0.6520 0.6508 0.0071 0.4355 0.0731
d=x-x(1)
d = 1×10
0 0.1427 0.1739 0.1876 0.2951 0.3297 0.3285 -0.3153 0.1132 -0.2492

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by