2016-07-06 146 views
0

我有30個名爲Data1.xls的文件到Data30.xls。在每個文件中,有兩張我感興趣。第一張被稱爲'Ergebnisse',在那裏我得到第二張紙的名字,這對我很重要。此工作表更改其名稱。我的問題在於,我不知道如何告訴Matlab使用更改表名。用Matlab讀取.xls文件的工作表名稱

我走到這一步:

liste = dir('*.xls');     % how many files in the folder 
liste=struct2cell(liste);    
liste=liste(1,:)';      

for i=1:length(liste)     % i=number of files 
    filename=['Data' num2str(i) '.xls']; 
    [num,txt,raw]=xlsread(filename,'Ergebnisse'); 
    sheet=txt(3,1); 
    [num,txt,raw]=xlsread(filename,sheet); 
end 

板材的答案是「T4_quer_3」我通常會寫入下一個xlsread,但它不工作。 感謝您的幫助

+0

請看工作區,並告訴蘇什麼樣的價值片。它碰巧是cell1x1嗎? – Finn

+0

是它的一個cell1x1 – DickesKind

回答

1

你不需要單元格txt(3,1),但它的內容。所以無論是去

sheet=txt{3,1};%notice the other brackets 

,或者你去

[num,txt,raw]=xlsread(filename,sheet{:}); %{:}content of a cell 
+0

謝謝你的作品!在此期間獲得了cell2mat ... – DickesKind