How to write a for loop that converts one file type to another?

4 ビュー (過去 30 日間)
Brittny Freeman
Brittny Freeman 2019 年 9 月 25 日
編集済み: Brittny Freeman 2019 年 9 月 25 日
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.

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 9 月 25 日
編集済み: KALYAN ACHARJYA 2019 年 9 月 25 日
See my answer here ralated to images call..do the same in your case
Or
More simpler @Stephan's Answer here
Try, any issue we are here to help you!

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by