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

1 visualizzazione (ultimi 30 giorni)
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 Commento
Sai Gudlur
Sai Gudlur il 1 Ago 2019
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');

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by