Splitting one column into multiple arrays

조회 수: 2 (최근 30일)
Ali
Ali 2019년 9월 29일
편집: Ali 2019년 9월 30일
I have a table P= 22952x 48. The rows contains data of 25 houses (groups).
I want to split data of each specific group(house) into sperate arrays.
I tried 'splitapply' function but i gives an error.
The data(.CSV) is also attached.
For example:
Home_1= 730x 48
Home_2= 830x 48
.
.
.
.
.
Home_25=198x48
-----------------
Total = 22952 x 48
------------------
  댓글 수: 2
dpb
dpb 2019년 9월 29일
We don't know how to interpret the data in the file, sorry...what's what in all those rows and columns and what, specifically, are you trying to do?
Also, attach the code you did try and the error text...just paste into the Answer additional info or add as Comment...
Ali
Ali 2019년 9월 29일
The first Coloumn represents the group ID. There are total 25 groups in first colomns.while the rows are showing their data.I want to split these group id seperately into new tables.
G = findgroups(data.id);

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

채택된 답변

Ajay Kumar
Ajay Kumar 2019년 9월 29일
z=xlsread('data.csv');
ids = unique(z(:,1),'stable');
houses = cell(length(ids),1);
house = struct();
for i = 1 : length(ids)
houses{i,1} = [ 'house' num2str(i) ];
house.houses{i,1} = z(find(z(:,1)==ids(i)),:);
end
The data of all houses are stored in struct house.
  댓글 수: 3
Ajay Kumar
Ajay Kumar 2019년 9월 29일
"all houses data in 1 table?"
You mean like in csv file?
Ali
Ali 2019년 9월 30일
편집: Ali 2019년 9월 30일
I want to arrange data in following way:
1). Group each categaries seprately and store in array/cell.
2).Generate artificial dates starting from
01-april-2012 00:00 % 30 minutes interval for 24hrs
to
31-March-2014 23:30
3). Store each house data in single column along the time series as shown in attached figure.
4.) Store all data in one table like:
% Form table
Col 1 Col 2 Col 3 ...................... Col 26
Date and time House A (data) House b (data).................... House z data

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by