Turn a structure into an array
Mostrar comentarios más antiguos
Hello everybody,
i'm starting with matlab and i have a problem with this code:
ev = load('EV.mat'); %potenciales evocados
fs = 3200; %sampling rate = 3200 Hz
slen = length(ev);
t=[1:slen]/fs;
vent=256; %amplitud ventana
sum=zeros(1,vent); %vector de ceros con 256 elementos
n=100; %numero de realizaciones
for i=0:vent-1
for k=1:25600
sum(i+1)=sum(i+1)+ev(i+k);
k=k+256;
end
end
i should sum 100 windows, each one containing 256 samples, of the same signal, the signal ev.Tthe problem is that the program gives me the following errors:
??? Undefined function or variable 'ev'.
??? Undefined function or method 'plus' for input arguments of type 'struct'.
Error in ==> Potenciales_Evocados at 17 sum(i+1)=sum(i+1)+ev(i+k);
Then, i guess i should transform this structure into an array, but i don't know how..! I've tried with "c = struct2cell(s)" but i create a cell array and the error is the same ??? Undefined function or method 'plus' for input arguments of type 'cell'.
In the command window i have this:
ev =
ev: [727040x1 double]
>> length(ev)
ans =
1
Please can anyone help me? Thank you very much in advance
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!