Data Filtering and transposing multiple variables stacked up in one/single row?

조회 수: 1 (최근 30일)
Sai Gudlur
Sai Gudlur 2019년 8월 1일
댓글: Sai Gudlur 2019년 8월 1일
Hello Everyone,
I have a set of data where i have 3 columns. First Column has 2 variables (Alpha,Beta) and they repeat themselves in the same order 50,000 times. Second Column has data corresponding to the varables. Third Column has time stamp.
1) I want to Seperate these variables Alpha and Beta as column names with there corresponding values in those respective columns.
2) Once the data is seperated i want to use time stamp and bin or packet both alpha and beta into one varible or table using my time stamp as reference.
Attaching my sample data to this message.
I tried both unstack and findgroups function in MATLAB and could get any result. Also adding my codes.
Any help would be greatly appreciated.
A = importdata('Data.xlsx');
x1=A.data(:,1);
x2=A.data(:,2);
y=A.textdata(2:end,1);
t=table(y,x1,x2);
[agroup,engine,pedal] = findgroups(t.engine_speed,t.accelerator_pedal_position);
%Second Code
A = importdata('Data.xlsx');
x1=A.data(:,1);
x2=A.data(:,2);
y=A.textdata(2:end,1);
t=table(y,x1,x2);
U = unstack(t,'engine_speed','accelerator_pedal_position');
  댓글 수: 1
Sai Gudlur
Sai Gudlur 2019년 8월 1일
I learnt what i was doing wrong. Pating my code below in the code section. If there is another efficient way of doing it i would to more than happy to learn that.
A = importdata('Data.xlsx');
x1=A.data(:,1);
x2=A.data(:,2);
y=A.textdata(2:end,1);
t=table(y,x1,x2);
t2 = unstack(t,'x1','y','GroupingVariables','x2');

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by