我想對我的拉曼光譜進行一些計算,我有一個問題來閱讀我的輸入文件。我的文件.txt
包含2列:X = Wavelength
(cm-1)和Y = Raman intensity
。文件名包含位置的座標或收集拉曼光譜,例如(0.00,-05.00)
或(-2.00,-0.50)
。我的Matlab代碼錯誤?
function Read_Raman_Files
% Reads Raman spectra from txt files.
% Each file contains the data for a single Raman spectrum:
% X = Wavelength (cm-1)
% Y = Raman intensity
% The name of the input file contains the coordinates at which the spectrum is taken.
% Results are stored in 'data.mat'.
files = dir('-5.0,0.00.txt');
Ncurves = length(files);
if Ncurves==0, display('No txt files found!'); return; end
for i = 1:Ncurves,
i
fname = files(i).name;
data = importdata(fname);
if i==1, X = data(:,i); end
Y(:,i) = data(:,2);
dash = strfind(fname,'__');
Xpos(i) = str2num(fname(strfind(fname,'Xµm_')+4:dash(2)-1));
Ypos(i) = str2num(fname(strfind(fname,'Yµm_')+4:dash(3)-1));
end;
save('data.mat', 'Ncurves', 'X', 'Y', 'Xpos', 'Ypos');
return
代碼包含serival了Syntex錯誤。你會告訴我你想在X和Y上執行什麼樣的計算,那麼我會根據那個修改你的代碼? –
錯誤是...什麼? – excaza
非常感謝您的回覆,我使用開源matlab代碼來擬合我的光譜並繪製地圖,我無法在此論壇中發佈此代碼的鏈接,但您可以在Google(搜索Amir Zabet拉曼matlab,第一鏈接) – Ben