I have multiple files of raw EMG data of different muscles that needs to be linear enveopled. I know how to do that and have made code for it but I was wonderig if there would be a way to run the code on multiple files to save some time. I know that a for loop of some sorts could be used but I do not understand how to create one for files instead of vectors. Is there any way to do this?
ex. the files can be found in 'C:, User, User1, Downloads, S02, S2_T3data, Proceessed_EMG, Cond_EMG "
the files are named : SCM_L, SCM_R, UTR_L, UTR_R
Thanks in advance

댓글 수: 5

Stephen23
Stephen23 2021년 3월 2일
편집: Stephen23 2021년 3월 2일
Ryan Chhiba
Ryan Chhiba 2021년 3월 2일
So for this method, I would have to rename all the files to have numbers, correct? So like SCM_L1, SCM_R2, UTR_L3, UTR_R4
Stephen23
Stephen23 2021년 3월 2일
편집: Stephen23 2021년 3월 2일
"So for this method, I would have to rename all the files to have numbers"
No. That page illustrates two basic approaches, neither of which require you to rename any files:
  • use dir to get a list of the files and iterate over that.
  • generate the names (which could be via indexing from an array or some other algorithm to create the names). This approach might suit your filenames, which seem to be combinations of two sets of strings.
You certainly do not have to number the filenames.
I have tried to use the dir function to get a list and I keep getting an error
Error in ForLoopPractise (line 2)
dir Users\ryanchhiba\Downloads\S02\Subject 2_VTAS
CA_JTTT_T1_Feb_23_2021_conditionedEMG.Processed_EMG.EMG_Processed.Conditioned_EMG
dir Users\ryanchhiba\Downloads\S02\Subject 2_VTAS CA_JTTT_T1_Feb_23_2021_conditionedEMG.Processed_EMG.EMG_Processed.Conditioned_EMG
thats the path, is it becase the Subject 2 file is a MATLAB file and I am looking for things in MATLAB?
Stephen23
Stephen23 2021년 3월 3일
Do not use command syntax, use function syntax exactly as the example in the documentation shows.

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

질문:

2021년 3월 2일

댓글:

2021년 3월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by