Filter löschen
Filter löschen

Splitting one column into multiple arrays

1 Ansicht (letzte 30 Tage)
Ali
Ali am 29 Sep. 2019
Bearbeitet: Ali am 30 Sep. 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 Kommentare
dpb
dpb am 29 Sep. 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 am 29 Sep. 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);

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Ajay Kumar
Ajay Kumar am 29 Sep. 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 Kommentare
Ajay Kumar
Ajay Kumar am 29 Sep. 2019
"all houses data in 1 table?"
You mean like in csv file?
Ali
Ali am 30 Sep. 2019
Bearbeitet: Ali am 30 Sep. 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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by