Error : Expression or statement is incorrect--possibly unbalanced (, {, or [.
Show older comments
i have a multichannel EEG and i try to filter all the channel but i got this error " Expression or statement is incorrect--possibly unbalanced (, {, or [." and i don't know to correct it
clc;
clear all;
close all;
load('C:\Users\del.dell-PC\pfe\base de donnée\patient sans crise\chb01_01_edfm.mat')
deriv1=(val(1,:)-0)/2.559375;
Fs=256;
t=(0:length(deriv1)-1)/Fs; %valeur du temps de tout échantillon%
figure (1),plot(t,deriv1)
legend('FP1-F7');
d1=designfilt('lowpassfir','PassbandFrequency',0.15,'StopbandFrequency',0.2,'PassbandRipple',3,'StopbandAttenuation',60,'DesignMethod','equiripple');
a = filtfilt(d1,(t,deriv1));
figure (2),plot(a,'r');
legend(' FP1-F7 Filtré');
5 Comments
per isakson
on 14 Mar 2017
Edited: per isakson
on 14 Mar 2017
The box in the upper right corner of the Matlab editor window displays red, which is caused by this line
a = filtfilt(d1,(t,deriv1));
Walter Roberson
on 14 Mar 2017
In other words, change the line to
a = filtfilt(d1,t,deriv1);
Jan
on 15 Mar 2017
@per and Walter: You have solved the problem. Let the OP accept an answer to mark the thread as solved.
majed samir
on 13 Apr 2019
Edited: Walter Roberson
on 13 Apr 2019
Error : Expression or statement is incorrect--possibly unbalanced (, {, or [. in statement [~, SortOrder]=sort( bee.Cost);
how solution?
% Empty Bee Structure
empty_bee.Position=[];
empty_bee.Cost=[];
% Initialize Bees Array
bee=repmat(empty_bee,nScoutBee,1);
% Create New Solutions
for i=1:nScoutBee
bee(i).Position=unifrnd(VarMin,VarMax,VarSize);
bee(i).Cost=CostFunction(bee(i).Position);
end
% Sort
[~, SortOrder]=sort( bee.Cost);
bee=bee(SortOrder);
Walter Roberson
on 13 Apr 2019
majed samir:
I suspect you are using a release before R2009b. You should use something like
[ThisVariableWillNotBeUsed, SortOrder] = sort([bee.Cost]);
clear ThisVariableWillNotBeUsed
bee = bee(SortOrder);
Note that even for R2009b and later, the code was incorrect. For later releases the line should have been
[~, SortOrder] = sort([bee.Cost]);
bee = bee(SortOrder);
Answers (0)
Categories
Find more on Subspace Methods in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!