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

6 次查看(过去 30 天)
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?

采纳的回答

Image Analyst
Image Analyst 2024-2-21
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.

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by