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

采纳的回答

Walter Roberson
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 个)

类别

Help CenterFile Exchange 中查找有关 Blue 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by