在Matlab中应用函数结构

时间:2017-08-21 20:08:46

标签: matlab function structure

目前,这是我的代码:

% Specify the folder where the files live.
myFolder = 'C:\Users\Irwin\Desktop\Matlab\Scintillator_project\advanced';
% Check to make sure that folder actually exists.  Warn user if it doesn't.
if ~isdir(myFolder)
  errorMessage = sprintf('Error: The following folder does not exist:\n%s', 
  myFolder);
  uiwait(warndlg(errorMessage));
  return;
end

% Get a list of all files in the folder with the desired file name pattern.
filePattern = fullfile(myFolder, '*.spe'); 
theFiles = dir(filePattern);
for k = 1 : length(theFiles)
  baseFileName = theFiles(k).name;
  fullFileName = fullfile(myFolder, baseFileName);
  fprintf(1, 'Now reading %s\n', fullFileName);
end

我目前有一个结构,其中每个条目都包含一个.spe文件。我想将函数readSPE(https://www.mathworks.com/matlabcentral/fileexchange/35940-readspe)应用于结构中的每个条目,以将它们从.spe格式转换为3D数组。

请帮忙!

谢谢:)

0 个答案:

没有答案