Clear Filters
Clear Filters

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

2 views (last 30 days)
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?

Answers (1)

Image Analyst
Image Analyst on 3 Feb 2014
Try the function call
storedVariables = load('SSTA.mat')
  2 Comments
Image Analyst
Image Analyst on 4 Feb 2014
Edited: Image Analyst on 4 Feb 2014
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)

Sign in to comment.

Categories

Find more on Search Path in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!