Matlab Legend after FOR loop

I create a file for reading in a certain number of WAV files, each of which corresponds to a musical note. I perform FFT on each of them and draw them all on the same figure. However, I had a problem with the legend printing correctly, it separates the names that I want to use into separate letters instead of using them as a string. My code is as follows:

clear all
mydir = 'Note Values/';
wavFiles = dir([mydir '*.wav']);
length(wavFiles)

legendText = [];
figure(1);
hold on;
for i = 1:length(wavFiles)

    wavFiles(i).name
    [y, fs] = wavread([mydir wavFiles(i).name]);
    sound(y, fs)

    currentSample = y(round(length(y)/2)-2048:round(length(y)/2)+2047);

    FFT = abs(fft(currentSample));
    Power = FFT.*conj(FFT)/length(FFT);

    if (mod(i, 2) == 1)
        h = plot(Power, 'Color', 'red');

    else
        h = plot(Power, 'Color', 'blue');
    end

    sri = wavFiles(i).name;
    sri
    legendText = [legendText, sri];

end
length(legendText)
legendText(1)
legend(legendText(:));
hold off;

The sri variable is always a full string, but legendText (1) only prints A instead of A3.wav. I know this is really something really obvious, but I just can't find it. Thanks

The result on my graph is as follows: alt text

+5
2

legendText{i} = sri

legend(legendText{:});

.

+3

MATLAB, , , , { <:

legendText = {legendText, sri};
+1

All Articles