Splitting one column into multiple arrays

3 次查看(过去 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