Dimension error using findpeaks function in Matlab on Power Spectral Density to calculate SNR of audio data
Firstly, here is how you can fix what you are tryin to do:
noisepsd{k} = psdvectors{k};
noisepsd{k}(signalpeaklocs{k}) = noisepsd{k}(signalpeaklocs{k}) - signalpeaks{k};

Secondly, here is why I think it is not the greatest idea: You are finding the peaks and subtracting them from the spectrum. This is actually equivalent to setting the points where you have local peaks to zero. In effect, you will have a spectrum that is equal to zero at all points where you have local peaks and equal to signal plus noise at all other points. I fail to see why this could be a good estimate of the noise power spectral density.
Thirdly, if you ask me how to do better, well... finding the SNR of a signal is like asking how to get A and B from C = A+B. You cannot! The problem is not unique. If we have a noisy signal, how would we know what is signal and what is noise, how to even properly define &quot;noise&quot; here? In general you cannot, because both could be stochastic. You can only find an approximation and this approximation will only work well if you know something about your signal. For instance, if you had a pure tone in noise, the problem becomes solvable. We can estimate the tone parameters (frequency, amplitude, phase) form the signal, remove it and treat the remaining part as noise. It works in this case because we know how to differentiate signal and noise, the signal should be tone-like. However, in general audio signals need not be tone-like at all.
The only answer I can give is studying your signals closely and trying to come up with some heuristic that describes them well. Maybe your signals are bandlimited, i.e., you have some regions in the frequency range where you expect no signals. Then you could use those to estimate the noise floor. You would need to assume thought that the noise floor is constant (i.e., the noise is white).
All this will only work if you know a thing or two about your signals. If you know nothing it's back to guessing A and B from C = A+B.