필터 지우기
필터 지우기

averaging columns in a table based on two other columns

조회 수: 3 (최근 30일)
Razin Sazzad Molla
Razin Sazzad Molla 2022년 6월 13일
답변: Peter Perkins 2022년 6월 14일
I am importing data from many csv files in a cell and they are tables. each table has 9 columns. They look like this:
Now, I want to average the displacement_pixel_ column for the values that have same y coordinate but move horizontally/ x pixels varying. For example I want to average the displacements for (x,y) = (168,40),(184,40)......(344,40) which will be mean(0.0843,0.01028,........0.3619).
That way I get a one column vector of all displcaemnt averaged over horizonatal direction. It's a 16*16 grid. Would anyone please be able to recommend something?
Thanks.

답변 (1개)

Peter Perkins
Peter Perkins 2022년 6월 14일
This should be straight-forward using either groupsummary, or varfun with displacement_pixel as the input/data variable and x_pixel as the grouping variable. I don't know where 16*16 figures into this, I don't know what you want to do across tables.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by