I want to calculate the avearge power of each channels , condition and frequency band
Afficher commentaires plus anciens
function test_spectra(spectra,pts,specfreqs,elcRegion)
avg_power=cell(length(elcRegion),6,2);
for i=1:length(elcRegion) %number of channals
for j=1:6 %condicion
for k=1:2 %band freqeuncy
for n=1:length(pts(:,1))
if pts(n,3)==j
sig_time=pts(n,3);
if pts(n,3)==1
rest_time=pts(n,3);
end
if k==1
avg_power(i,j,k)=bandpower(spectra(:,i,sig_time),1000,[12 30])/bandpower(spectra(:,i,rest_time),1000,[12 30]);
else
avg_power(i,j,k)=bandpower(spectra(:,i,sig_time),1000,[30 70])/bandpower(spectra(:,i,rest_time),1000,[30 70]);
end
end
end
end
end
end
figure()
histogram(avg_power(6,3,1),30)
end
this is the problam :
Conversion to cell from double is not possible.
thank you!!
Réponses (1)
I understand that you are facing an issue in converting double to cell.You can achieve this using a function called num2cell .
%In this we will try to convert a vector of doubles to cell array using num2cell function
numArray=[1.1 2.2 3.3]; %vector of doubles.
%converting to cell array using the num2cell function
cellArray=num2cell(numArray)
To know more about this function,checkout the following documentation:
I hope this resolves your issue
Regards,
Venkat Siddarth V
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!