Dot indexing is not supported for variables of this type

hello, i have this feature Extraction algorithm but i have error : Dot indexing is not supported for variables of this type
xApp = av_train;
data=xApp (: , 1);
type = 1;
feature=featureExtraction(data,'mean',type);
there is my feature Extraction function, can anyone help me please
function feature=featureExtraction(data,param,type)
%
%Input:
% data:nxm, n:#of patterns, m: number of features
% method:'raw','mean','meanVar'
% window: window length
% type: 1 --- for movtimavg
% 2 --- for windowingLabels
switch param.method
case 'raw', feature = data;
case 'mean'
if (type==1)
feature = movtimavg(data,param.window,param.step);
end
if (type==2)
feature = windowingLabels(data,param.window,param.step);
end
case 'meanVar',feature = movtimavg(data,param.window,param.step,1);
if (type==1)
feature = movtimavg(data,param.window,param.step,1);
end
if (type==2)
feature = windowingLabels(data,param.window,param.step);
end
end

 Accepted Answer

Change
xApp = av_train;
data=xApp (: , 1);
type = 1;
feature=featureExtraction(data,'mean',type);
to
xApp = av_train;
data=xApp (: , 1);
param.method = 'mean';
param.window = 3; % change window size, as needed
param.step = 2; % change step size, as needed
type = 1;
feature=featureExtraction(data,param,type);

3 Comments

now i have this error :( :
Reference to non-existent field 'method'.
Error in featureExtraction (line 10)
switch param.method
Error in main (line 8)
feature=featureExtraction(data,param,type);
OK, try the modified code in my answer. I'm not sure what window or step sizes might work for you, however.
thank you so much the problem is solved !

Sign in to comment.

More Answers (1)

Evidently param is not a structure like you thought.
Also
case 'meanVar',feature = movtimavg(data,param.window,param.step,1);
should be on two lines, not one.

2 Comments

i didnt understand sorry, what should i do to correct that ?
Well, put them on different lines.
case 'meanVar'
feature = movtimavg(data,param.window,param.step,1);

Sign in to comment.

Products

Release

R2020b

Community Treasure Hunt

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

Start Hunting!