Get handle of subplot with CData
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Christopher Grose
am 18 Okt. 2018
Beantwortet: Walter Roberson
am 18 Okt. 2018
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 18 Okt. 2018
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!