Splitting one column into multiple arrays

2 visualizaciones (últimos 30 días)
Ali
Ali el 29 de Sept. de 2019
Editada: Ali el 30 de Sept. de 2019
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 comentarios
dpb
dpb el 29 de Sept. de 2019
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 el 29 de Sept. de 2019
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);

Iniciar sesión para comentar.

Respuesta aceptada

Ajay Kumar
Ajay Kumar el 29 de Sept. de 2019
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 comentarios
Ajay Kumar
Ajay Kumar el 29 de Sept. de 2019
"all houses data in 1 table?"
You mean like in csv file?
Ali
Ali el 30 de Sept. de 2019
Editada: Ali el 30 de Sept. de 2019
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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by