How can I import multiple Excel files?
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
files = dir('*.xls');
for i=1:length(files)
x = eval(['importdata(files(i).name)']);
z1 = x.data(:,5); %grabs column 5 from x.data
z2 = x.data(:,6); %grabs column 6 from x.data
%%obtains value closest to 0 in column 'z2'
numb=0;
[~, imin] = min(abs(z2 - numb));
value(i) = z2(imin)
plot(z1,z2)
end
When trying to run the code above, I get this error
>> test2
Warning: File contains uninterpretable data.
> In importdata (line 144)
In test2 (line 3)
Index in position 2 exceeds array bounds.
Error in test2 (line 4)
z1 = x.data(:,5); %grabs column 5 from x.data
However, if I attempt to import ".txt" files it works just fine. How can I import multiple excel files?
4 件のコメント
Jan
2018 年 6 月 6 日
Brrrr, the evil eval. start with replacing this bad command by:
x = importdata(files(i).name);
But the error message will be the same:
Warning: File contains uninterpretable data.
We cannot know, what this means, if you do not post the file.
Asher Zaidi
2018 年 6 月 6 日
Asher Zaidi
2018 年 6 月 6 日
Asher Zaidi
2018 年 6 月 6 日
回答 (0 件)
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!