필터 지우기
필터 지우기

Split data into groups without applying a function

조회 수: 34 (최근 30일)
Raúl García Odriozola
Raúl García Odriozola 2023년 6월 27일
편집: Raúl García Odriozola 2023년 6월 28일
First, i would like to apologize for not showing the code, it's part of a group project and i don't want to show code without permission
That being said i was trying to group data from an array, with findgroup() i was able to make some groups and then create an array that show the group and it's asociated data but instead i would like an array that shows the groups in the first column (1,2,3,4, etc tha name of the groups are irrelevant for now) and on the second column all the data that's from said group. I've been thinking about splitapply but that function always use a function with the data.
For clearification, what i want is the intermediate step of this example image:

채택된 답변

Matt J
Matt J 2023년 6월 28일
G=findgroups(Gender);
groupedHeight=splitapply(@(x){x}, Height,G)
  댓글 수: 1
Raúl García Odriozola
Raúl García Odriozola 2023년 6월 28일
편집: Raúl García Odriozola 2023년 6월 28일
Thank you, that's exactly what i'm looking for

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by