How can I apply a function to some nearby cells of one column and store the results in a new column which we easily do in Excel as shown in the figure ?

조회 수: 1 (최근 30일)
  댓글 수: 2
Lei Hou
Lei Hou 2021년 10월 18일
Hi Manjula,
In MATLAB table, all the columns ( we call them variables) should be in the same height. In your picture, what is your expected value of B1, B2, B4 and B5? Are you OK with saving the new column in another table?
Thanks,
Lei
Manjula Wickramathilaka
Manjula Wickramathilaka 2021년 10월 18일
Thank you for attending to this question. I want to copy the same formula from B3 until B8. It's OK if the output can be taken to another table or a separate array. I know that specific functions are there for the 'moving mean', 'moving average', etc but I want to know whether there is a general way to apply a function to a moving window

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

답변 (1개)

Arun
Arun 2024년 2월 22일
Hi Manjula,
I understand that you wish to apply a function over a column in a moving window order.
MATLAB provides a function, “tA = matlab.tall.movingWindow(fcn,window,tX), that applies the function “fcn once per window as the window moves over the first dimension of “tX. The output “tA is the vertical concatenation of the results of applying “fcn to each window.
For more information regarding “matlab.tall.movingWindow, please refer the documentation link: https://www.mathworks.com/help/matlab/ref/matlab.tall.movingwindow.html
HTH

카테고리

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

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by