error " Undefined function 'data_ref' for input arguments of type 'double'. " - matlab

my code matlab for denoising EEG artifact show me always this error : "error " Undefined function 'data_ref' for input arguments of type 'double'. "
%% Load Reference Data
load data_ref;
data_ref = data_ref(1:data_length)*10/2^15;
data_ref = power_supply_noise_remove(data_ref, Fs);
data_ref = data_ref - mean(data_ref);
data_ref = [data_ref data_ref];**
the error is line 26:
Undefined function 'data_ref' for input arguments of type 'double'.
Error in art_emd_ica (line 26) data_ref = data_ref(1:data_length)*10/2^15;

Related

why following error is occurred when i am trying to read image file by imread?

I have to concatenate the path and file name but the following error is coming as given below:
path = 'E:\Ob_Extraction\peta\PETA dataset\3DPeS\archive\';
allFiles = dir( 'E:\Ob_Extraction\peta\PETA dataset\3DPeS\archive' );
allNames = { allFiles.name };
image = imread(strcat(path,allNames(3)));
Error using imread>parse_inputs (line 457)
The file name or URL argument must be a string.
Error in imread (line 316)
[filename, fmt_s, extraArgs] = parse_inputs(varargin{:});
how do i solve it ?

Computer Vision: Path for playing video

I want to use video from following directory
'E:\Multimedia Security\matlab\UCSD_Anomaly_Dataset.v1p2\UCSDped1\Train\Train001'
Following is the code which i wrote
close all
clear all
clc
workingDir = 'E:\Multimedia
Security\matlab\UCSD_Anomaly_Dataset.v1p2\UCSDped1\Train\Train001';
videoofReader = vision.VideoFileReader(dir(fullfile(workingDir, 'abc.avi')));
videoPlayer = vision.VideoPlayer;
while ~isDone(videoofReader)
frame = step(videoofReader);
step(videoPlayer, frame);
end
release(videoofReader);
release(videoPlayer);
Error which i get is
`Error using VideoFileReader.set.Filename (line 139)
Expected Filename to be one of these types:
char
Instead its type was struct.
Error in C:\Program
Files\MATLAB\R2012a\toolbox\matlab\system\+matlab\+system\setProp.p>setProp
(line 14)
Error in
C:\ProgramFiles\MATLAB\R2012a\toolbox\matlab\system+matlab+system\SystemProp.p>SystemProp.set (line
373)
Error in C:\Program Files\MATLAB\R2012a\toolbox\matlab\system+matlab+system\SystemProp.p>SystemProp.parseInputs
(line 635)
Error in C:\Program
Files\MATLAB\R2012a\toolbox\matlab\system+matlab+system\SystemProp.p>SystemProp.setProperties
(line 138)
Error in C:\Program
Files\MATLAB\R2012a\toolbox\vision\vision+vision\VideoFileReader.p>VideoFileReader.VideoFileReader
(line 131)
Error in kl2 (line 18)
videoofReader = vision.VideoFileReader(dir(fullfile(workingDir, 'abc.avi')));
System prompts you Error in kl2 (line 18) so this line has a problem. You do not need to use dir because you already have an absolute path.
Give you two solutions:
videoofReader = vision.VideoFileReader(fullfile(workingDir, 'abc.avi'));
dirstruct = dir(fullfile(workingDir, 'abc.avi'));
videoofReader = vision.VideoFileReader(dirstruct{1});

Undefined function or variable "Vk" when using sysic to create an interconnected system

I am attempting to use sysic to create an interconnected system from a number of state space models. However; I keep recieving the same error:
Undefined function or variable "Vk".
Error in sysic (line 212)
[ard,arl,er] = LOCALpass1(Vk);
Error in addOutputWeights (line 62)
sysic
The code used that generates this error is as follows:
systemnames = 'plantModel WControl WError';
inputvar = '[r(4); u(4)]';
outputvar = '[WControl; WError;r- plantModel]';
input_to_WError = '[r-plantModel]';
input_to_WControl = '[u]';
sysoutname = 'instramentedPlant';
cleanupsysic= 'yes';
sysic
This error was caused because input_to_plantModel was not present in the workspace. For every system that is refered to in systemnames there must be a corresponding input_to_X.
The following code runs correctly
systemnames='plantModel wControl wError';
inputvar ='[r(4); u(4)]';
outputvar ='[wControl;wError;r- plantModel]';
input_to_plantModel ='[u]';
input_to_wError ='[r-plantModel]';
input_to_wControl ='[u]';
sysoutname ='instramentedPlant';
cleanupsysic = 'yes';

matlab fails deployment in internal code

I want to compile a gui matlab project, but fail because of this error which is not in my code
Subscript indices must either be real positive integers or logicals.
Error in isscript (line 7)
if strcmpi(pth(end-1:end), '.m') && exist(pth, 'file') == 2
Error in matlab.depfun.internal.Schema/move/#(setMembers)setMembers(~isscript(setMembers))
Error in matlab.depfun.internal.Schema>applyMoveFcn (line 987)
keptFiles = fcn(fileList);
Error in matlab.depfun.internal.Schema>#(files,destMap)applyMoveFcn(op,files,destMap,destSet,reason,rule) (line 822)
#(files, destMap)applyMoveFcn(op, files, destMap, ...
Error in matlab.depfun.internal.Schema/applySetRules (line 141)
xformedSet = feval(operations{n}, xformedSet, rMap);
Error in matlab.depfun.internal.Completion/applySetRules (line 1059)
[modifiedList, rMap] = ...
Error in matlab.depfun.internal.Completion/initializeRootSet (line 1142)
[addedFiles, ruleFilter, notes] = ...
Error in matlab.depfun.internal.Completion (line 1601)
obj.RootSet = initializeRootSet(obj, files);
Error in matlab.depfun.internal.requirements (line 166)
c = matlab.depfun.internal.Completion(files, tgt);
Error in appcreate.internal.appbuilder.getDependencyList (line 173)
[dependentfiles, depproducts, ~] = matlab.depfun.internal.requirements(varargin, 'MATLAB');
How can I get matlab (2013b) to compile the package?
The code where matlab fails is (which is NOT my code)
function tf = isscript(files)
% ISSCRIPT Is the file a script file?
tf = false(1,numel(files));
for k=1:numel(files)
pth = files{k};
% Can't be a script if it isn't an M-file.
if strcmpi(pth(end-1:end), '.m') && exist(pth, 'file') == 2
mt = matlab.depfun.internal.cacheMtree(pth);
fcn = mtfind(mt, 'Kind', 'FUNCTION');
tf(k) = isempty(fcn);
end
end
The code will fail for files with a filename of length 1. Either rename all files with such a short filename or change the line to:
if length(pth)>1 && strcmpi(pth(end-1:end), '.m') && exist(pth, 'file') == 2

Error reading AVI files in MATLAB

I am working on extracting features from avi files using MATLAB. Every time I run the code I get an error "Exception in Reading". Code is:
cd('D:\Classified\negative-videos');
neg_files = dir('*.avi');
% compute negative files
for fileIter=1:size(neg_files,1)
tic;
movie_name = neg_files(fileIter).name;
try
[color_score__,edge_score__,spatio_score__,score__] = lg_model(movie_name,fps,3);
if(score__ < threshold)
true_neg = true_neg + 1 ;
end
if(score__ >= threshold)
false_pos = false_pos + 1 ;
end
fprintf('[ %d / %d ]\tFile : %s\tscore : %f\tcolor_score : %f\tspatio_score : %f\n', fileIter,size(neg_files,1),movie_name, score__,color_score__, spatio_score__);
catch ME1
fprintf('[ %d / %d ]\tFile : %s\t EXCEPTION IN READING \n', fileIter,size(neg_files,1),movie_name);
end
toc;
end
fprintf('INTERMEDIATE\ttrue pos = %d \n false pos = %d \n true neg = %d \n false neg = %d \n', true_pos,false_pos,true_neg, false_neg);
What is the problem with the above code snippet?
The stack trace is as follows:
For each of the 18 videos in my directory I get following error:
[ 1 / 18 ] File : 38-Meter High Dive Goes Wrong.avi EXCEPTION IN READING
ME1 =
MException
Properties:
identifier: 'MATLAB:UndefinedFunction'
message: 'Undefined function or method 'VideoReader' for input arguments of type 'char'.'
cause: {}
stack: [3x1 struct]
Methods
ME1 =
MException
Properties:
identifier: 'MATLAB:UndefinedFunction'
message: 'Undefined function or method 'VideoReader' for input arguments of type 'char'.'
cause: {}
stack: [3x1 struct]
Methods
MException
Properties:
identifier: 'MATLAB:UndefinedFunction'
message: 'Undefined function or method 'VideoReader' for input arguments of type 'char'.'
cause: {}
stack: [3x1 struct]
Methods
Undefined function or method 'VideoReader' for input arguments of type 'char'.
3x1 struct array with fields:
file
name
line
MATLAB:UndefinedFunction
Elapsed time is 0.017901 seconds.
Apologies for not posing as a comment, but need a little more rep before I'm allowed to.
I agree with #JimInCO, it looks like you don't have VideoReader. It was first introduced in R2010b. You can try using aviread instead if you have an older version.