How to segment an EMG signal according to a column value?

7 vues (au cours des 30 derniers jours)
RIFAT
RIFAT le 21 Fév 2024
Commenté : RIFAT le 21 Fév 2024
I have am EMG dataset, where multiple datas are combined together according to class in a column. Each class represent different muscle activity. Like, class is marked as 1 for hand at rest, where 2 for wrist flexion. I want to segment that data according to class 1 or 2. How to segment this dataset?

Réponse acceptée

Image Analyst
Image Analyst le 21 Fév 2024
If your data are in a regular matrix, you can use indexing to extract rows for that class. For example if column 2 contains the class number, you can do
%-------------------------------------------------------------------------------------------
% Get indexes for the rows for the desired class numbers
% Find rows that are marked as class 1.
class1Rows = data(:, 2) == 1;
% Find rows that are marked as class 1.
class2Rows = data(:, 2) == 2;
% Find rows that are marked as EITHER class 1 or class 2.
class1Orclass2Rows = class1Rows | class2Rows;
%-------------------------------------------------------------------------------------------
% Using those indexes, extract the data for the desired class numbers into new variables.
class1 = data(class1Rows, :); % Extract only class 1 rows.
class2 = data(class2Rows, :); % Extract only class 2 rows.
class1OR2 = data(class1Orclass2Rows, :); % Extract if it's EITHER class 1 OR class 2.
  1 commentaire
RIFAT
RIFAT le 21 Fév 2024
Thank you. Your help means a lot to me.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by