How to extract data from different strata?
이전 댓글 표시
I want to extract the data from the perticular strata, but the problem is i have to do it manually, and that is very time consuming. I want to create a code which can extract the data easily. I have attached the excel file of dataset for reference.
Ex: In the attached file, you see there are different data in the columns provided along with the strata number. Now, i have to read the in matlab for further process, like i want to separate the data of all the strata.
Say: Strata 1 has one row of data, but strata 3 has two rows of data. So, if i recall the data from strata 3, it will read the whole data of strata 3.
채택된 답변
추가 답변 (1개)
data = xlsread('Dataset.xlsx')
data(:,end) = fillmissing(data(:,end),'previous');
stratadata = splitapply(@(x){x},data(:,1:end-1),findgroups(data(:,end)))
Now stratadata is a cell array with each cell containing one stratum of data. To access a particular stratum's data, use curly braces, e.g.:
stratadata{3} % data for 3rd stratum
stratadata{13} % data for 13th stratum
카테고리
도움말 센터 및 File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!