Get handle of subplot with CData
조회 수: 2 (최근 30일)
이전 댓글 표시
The following throws a 'There is no CData property on the Axes class' error, but I don't know how to resolve it.
% initiate figure and get subplot handles
ynum = 100;
xnum = 100;
xgrid = 0:1:(xnum-1);
ygrid = 0:1:(ynum-1);
figure(2); hold on;
subplot(2,2,1); imagesc(xgrid,ygrid,zeros(ynum,xnum)); caxis([0 0.75]); colormap(jet(256)); colorbar; title('0');
subplot(2,2,2); imagesc(xgrid,ygrid,zeros(ynum,xnum)); caxis([0 1.00]); colormap(jet(256)); colorbar; title('phase field (P1)');
subplot(2,2,3); imagesc(xgrid,ygrid,zeros(ynum,xnum)); caxis([0.15 0.85]); colormap(jet(256)); colorbar; title('comp field (A)');
subplot(2,2,4); imagesc(xgrid,ygrid,zeros(ynum,xnum)); caxis([1 1000]); colormap(jet(256)); colorbar; title('crystal field');
handles.img(1) = subplot(2,2,1); truesize;
handles.img(2) = subplot(2,2,2); truesize;
handles.img(3) = subplot(2,2,3); truesize;
handles.img(4) = subplot(2,2,4); truesize;
hold off;
% update figure
for t=1:10
figure(2);
set(handles.img(1),'CData',rand(ynum,xnum)); title(num2str(t));
set(handles.img(2),'CData',rand(ynum,xnum));
set(handles.img(3),'CData',rand(ynum,xnum));
set(handles.img(4),'CData',rand(ynum,xnum));
end
댓글 수: 0
채택된 답변
Walter Roberson
2018년 10월 18일
subplot(2,2,2); handles.img(2) = imagesc(xgrid,ygrid,zeros(ynum,xnum)); caxis([0 1.00]); colormap(jet(256)); colorbar; title('phase field (P1)');
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Subplots에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!