How can I create a loop so that I can analyze 100 files at a time?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Ellen
am 6 Jan. 2015
Kommentiert: Image Analyst
am 6 Jan. 2015
I've looked everywhere and tried everything in my limited knowledge of MatLab. I wrote a code for two files that I want to be able to repeat for 200 files. Anyone know how I can loop the following so that it will read the excel file and analyze the data at the same time?
charge=xlsread('C:\Users\Documents\Battery\LiFePO4-KAU-3_Cha_1_003.xlsx');
discharge=xlsread('C:\Users\Documents\Battery\LiFePO4-KAU-3_Dis_1_004.xlsx');
timeC=charge(4:45,3);
currentC=charge(4:45,4);
voltageC=charge(4:45,8);
surfacetempC=charge(4:45,6);
timeD=discharge(4:6426,3);
currentD=discharge(4:6426,4);
voltageD=discharge(4:6426,8);
surfacetempD=discharge(4:6426,6);
Now instead of having one charge cycle and one discharge cycle, I have 100 of each.
I tried looping like I found on some examples where you replaced the number on the file name with a %f. I tried loop reading the files and then loop analyzing the files, but when it reads them it does cells within cells and I'm not very familiar with how those work and thus everything I tried to pull the data out of them failed.
Any and all help would be greatly appreciated. I am super stuck and don't know what to try next.
Thank you.
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 6 Jan. 2015
But for 200 files, you don't want to call xlsread() unless you are willing to wait a long time. You'd be best off using ActiveX, like in my attached demo.
2 Kommentare
Image Analyst
am 6 Jan. 2015
You do know how, and you are doing it . You've called xlsread() and you're doing things like
surfacetempC=charge(4:45,6);
which is pulling data out of one array and putting it into another. So you've proven you know how.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!