Hi there,
I have a sample of muscle contractions from 12 different muscles for 10 subjects. All time normalized (100AU). I want to apply the following calculation to each one of them without having to copy paste the code:
Max = max(muscle); %muscle has to be specified by hand
threshold = 0.25*Max;
indices = find(abs(muscle)>2);
muscle(indices) = NaN;
So basically I am finding the maxEMG activity of the contraction, taking 25% as a cuttoff threshold and eliminating any value below that threshold. And I would like that to be repeated for each muscle, but I can't figure out how to use a loop whithout the name of the muscle being the same over and over.
Any ideas?
Thanks in advance!

댓글 수: 6

madhan ravi
madhan ravi 2018년 11월 30일
why not put all the 12 muscles in a matrix like [muscle;muscle1;...]?
Marc Elmeua
Marc Elmeua 2018년 11월 30일
Because then the max function would get the max of all the muscles, no? I need the max of each muscle.
no if you do
max(muscles,[],2) % you will get max of each muscles
Greg
Greg 2018년 12월 2일
Also, the find is unnecessary in this situation. Logical indexing is much better.
Marc Elmeua
Marc Elmeua 2018년 12월 4일
ok thanks! works fine!
madhan ravi
madhan ravi 2018년 12월 4일
comment moved to answer section

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

 채택된 답변

추가 답변 (1개)

Image Analyst
Image Analyst 2018년 12월 2일

0 개 추천

I'm guessing that the 10 subjects data is in 10 different data files. You need to read in each one, and process it, which might mean processing each of the 12 signals for that subject. So you need to loop over all files like is explained in the FAQ: Click Here

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2018년 11월 30일

답변:

2018년 12월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by