Plot vectors in cell array over for loop

Illustration
Charlie - 2020-11-30T10:23:42+00:00
Question: Plot vectors in cell array over for loop

I have the following data structure (a cell array populated with vectors): sigvecarray = {}; freqarray = {}; % Reading the audio files, getting the signal vector and the corresponding for k = 1:numel(inputarray) % indices curr_input = inputarray{k}; [y, Fs] = audioread(curr_input); sigvecarray{k} = y; freqarray{k} = Fs; end I'm trying to plot them over a for loop by using the following:   for k = 1:numel(sigvecarray) plot(sigvecarray{k}) end But I get only the fist vector plotted as my output. What could I be doing wrong here? Is it because the cell array is a row vector? If yes, how do I convert the cell array to a column vector from a row vector?

Expert Answer

Profile picture of John Williams John Williams answered . 2025-11-20

figure
hold on
for k = 1:numel(sigvecarray)
    plot(sigvecarray{k})
end


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!