Plot vectors in cell array over for loop

C
Charlie · Nov 30, 2020 · 2K views
Question
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 PhD Expert
Answered Aug 25, 2026
figure
hold on
for k = 1:numel(sigvecarray)
    plot(sigvecarray{k})
end
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!