How to store data into a matrix?
Show older comments
I'm calculating Zerocross (ZCR) and Short term energy (STE) for a signals in a matrix. After I calculate these features I want to store results into one matrix F to contain both features STE and ZCR, like this :
F=[STE1][ZCR1]
[STE2][ZCR2]
[STE3][ZCR3]...
B is 1x59 cell array which cells are matrixes B = {[240x1], [480x1],[960x1] ...} so each cell is another matrix.
So I want my output to be like this
F = [240x1][ZCR1]
[480x1][ZCR2]
[960x1][ZCR3] ...
% first column (e.g.[240x1]) is STE calculation of the first column in B, and second column is a calculation of the Zerocross also of the first column of the cell array B..and so on
How can I get that output? My code is next:
for i=1:length(V)
V=B{1,i}
%zerocross
zcd = dsp.ZeroCrossingDetector;
numZeroCross = step(zcd,V)
ZER{i}=numZeroCross %output for zerocross
%short term energy
winLen=length(V)
energyST = sum(V.^2,winLen)
EN{i}=energyST %output for STE
end
2 Comments
Jan
on 13 Mar 2017
Matrix B is 1x59 cell array which looks like this
B = {[240x1], [480x1],[960x1] ...} so each cell is a matrix.
This is not easy to understand. What is "B"? If B is a "matrix", it is not a "cell vector". What is the relation between "B" and the shown "F"? What exactly does "[240x1,ZCR1]" mean? What is "ZCR1"?
Lara Lirnow
on 13 Mar 2017
Accepted Answer
More Answers (1)
Lara Lirnow
on 13 Mar 2017
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!