필터 지우기
필터 지우기

Subtract a different number from every group n of values in a table

조회 수: 1 (최근 30일)
Stormi Noll
Stormi Noll 2021년 3월 12일
댓글: ANKUR KUMAR 2021년 3월 15일
I am trying to find the perturbations in my data based on a 30 minute time average for 24 hour data.
My original data has 1728000 rows, divided by 48 is 36000. So each of the 36000 entries need to subtract value 1 from the other table, the next 36000 entries will subtract value 2. I have tried for loops and I can't get anything to work past the 36000 entries.
I need something to perform the following:
big_table.uprime(1:36000) = big_table.B_Ux_2(1:36000) - thirtymin.u30(1);
big_table.uprime(36001:72000) = big_table.B_Ux_2(36001:72000) - thirtymin.u30(2);
and so on

답변 (1개)

ANKUR KUMAR
ANKUR KUMAR 2021년 3월 12일
You can use reshape to perform operations:
data=randi(20,1,1728000);
B=reshape(data,36000,[]);
B=B-ones(size(B,1),size(B,2)).*[1:size(B,2)];
data_new=reshape(B,size(data,1),[]);
  댓글 수: 4
Stormi Noll
Stormi Noll 2021년 3월 13일
B = reshape(big_table.B_Ux_2 ,6000, []);
for i = 1:288
B(:,i) = B(:,i) - fivemin.u5(i);
end
big_table.uprime5 = reshape(B, size(big_table, 1), []);
I used a combination of our methods. Thanks for the advice.
ANKUR KUMAR
ANKUR KUMAR 2021년 3월 15일
Could you please accept the answer if it helps you.

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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by