How to write a for loop that converts one file type to another?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello all,
I have 34 files saved in my working directory folder of the type .edf, and I am using the function "edfread" to convert them to a type that is readible by matlab. I have no problem using the function to convert 1 file at a time, however, I would like to write a for loop to convert all of the 34 edf files at once.
The saved edf files are saved like this (each subject has 2 channes of data):
Subject0_1.edf
Subject0_2.edf
Subject1_1.edf
Subject1_2.edf
Subject2_1.edf
Subject2_2.edf
Subject3_1.edf
Subject3_2.edf
Subject4_1.edf
Subject4_2.edf
Subject5_1.edf
Subject5_2.edf
and so on....
My code to convert the edf file for a single subject looks like this:
[Hdr_Subj0_1,Sig_Subj0_1]= edfread('Subject0_1.edf');
[Hdr_Subj0_2,Sig_Subj0_2]= edfread('Subject0_2.edf');
( I don't want to copy and past these same 2 lines of code 34 times)
I know that I need to use %d someplace in my for loop, but I can't figure out exactly how to code it.
for i = 1:34
[Hdr_Subji_1,Sig_Subji_1]= edfread('Subject%d_1.edf');
[Hdr_Subji_2,Sig_Subji_2]= edfread('Subject%d_2.edf');
end
is not working. Any help or suggestions would be very much appreciated.
댓글 수: 0
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Language Support에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!