Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
Ralph
Ralph am 3 Feb. 2014
Bearbeitet: Image Analyst am 4 Feb. 2014
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?

Antworten (1)

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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Search Path finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by