Plot Matrices stored in Cell Array
조회 수: 3 (최근 30일)
이전 댓글 표시
I have a 1by2 cell array that has the following elements
C{1}= [ 1 2 3 4 5 6]
C{2}= [987 877 77 666 777 66 77 ]
I want to plot these matrices C{1} and C{2} on the same graph.
Pleas help.
댓글 수: 0
채택된 답변
Ameer Hamza
2020년 3월 7일
You can plot elements of a cell array on the same graph by holding the axes. For example,
C{1} = [1 2 3 4 5 6];
C{2} = [987 877 77 666 777 66 77];
fig = figure();
ax = axes();
hold(ax);
for i = C
plot(i{:});
end
댓글 수: 7
Ameer Hamza
2020년 3월 7일
편집: Ameer Hamza
2020년 3월 7일
You can get the index of last element using this
cellfun(@(x) numel(x), C)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!