I am new to Matlab and working through code I have found to understand each step. You can see my comments describing in as much detail as I can, what is going on in each step.
This is a for loop which I plan to use to calculate the mean sound pressure level (SPL) of a large batch of sound files.
I understand what is going on in each step and have carried out each in turn, before executing the loop, to make sure everything works.
However, in the last step, where I combing meanlevellist and mean_SPL into an array, I get an error telling my that the dimensions of the two lists are different. I understand what this means in theory but I don't know how to fix it, or see exactly where I have gone wrong, in my code.
ANY advice would be much appreciated!!
I am very keen to develop and advance here.
>> clf; clear all;
d = dir('*.wav');
meanlevellist = zeros(size(d));
for i = 1:length(d)
filename = d(i).name;
cal = 171.7;
fact_cal = 10^(cal/20);
meanlevellist(i) = mean_SPL;
meanlevellist = [meanlevellist, mean_SPL];
Error using horzcat
Dimensions of arrays being concatenated are not consistent.