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?
채택된 답변
추가 답변 (1개)
Ameer Hamza
2020년 10월 12일
편집: Ameer Hamza
2020년 10월 12일
hold on
will add new lines on the same axes without deleting old lines.
댓글 수: 3
skrowten_hermit
2020년 10월 12일
편집: skrowten_hermit
2020년 10월 12일
Ameer Hamza
2020년 10월 12일
You need to use the Position property of the axes object to change their size. An alternative might be to use
nexttile(): https://www.mathworks.com/help/matlab/ref/nexttile.html. Though I am not sure if there is a significant difference.
skrowten_hermit
2020년 10월 12일
카테고리
도움말 센터 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!