??? Undefined function or method 'SSTA' for input arguments of type 'char'

2 次查看(过去 30 天)
I run a script file with command 'load SSTA.mat'. The file 'SSTA.mat' is in the same folder as the script, so there should be no path issues. Why do I get the error '??? Undefined function or method 'SSTA' for input arguments of type 'char'' and how do I fix it?

回答(1 个)

Image Analyst
Image Analyst 2014-2-3
Try the function call
storedVariables = load('SSTA.mat')
  2 个评论
Image Analyst
Image Analyst 2014-2-4
编辑:Image Analyst 2014-2-4
Show your code, and the COMPLETE error message - all the red text, not just part of it.
Try this more robust code:
% Change the current folder to the folder of this m-file.
% (The line of code below is from Brett Shoelson of The Mathworks.)
cd(fileparts(which(mfilename)));
% Read in a standard MATLAB mat file.
% First get the full file name.
folder = pwd
baseFileName = 'SSTA.mat';
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
% Check if file exists.
if ~exist(fullFileName, 'file')
% File doesn't exist -- didn't find it there. Check the search path for it.
fullFileName = baseFileName; % No path this time.
if ~exist(fullFileName, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist in the search path folders.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
storedVariables = load(fullFileName)

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Search Path 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by