How to plot multiple Contours in a 'parent' Figure.

2 visualizzazioni (ultimi 30 giorni)
Hi
I have 3D matrix (32*101*5) that I want to plot a contour for each of 5 planes of data in one figure in a 'for' loop. But when I run the code this error comes up:
(( Unable to use a value of type 'matlab.ui.Figure' as an index)).
I appreciate your helps
  3 Commenti
dpb
dpb il 16 Ago 2019
Show us the code section you're trying to use...and the full error message in context.
NB: If you try this on a 2D axes, unless the data are unusual you'll probably just end up with a mess...maybe you're looking for countour3 where you use the plane numbers and the Z elevation?
Hossein Khanjari
Hossein Khanjari il 16 Ago 2019
Modificato: Geoff Hayes il 16 Ago 2019
Thanks for your reply, Here is the code in which the V_dist is the matrix that has the size of (32*101*5) and I want to plot the contours of each plane in Yf in figACT
root = pwd;
% Create the Figure window
figACT = figure('InvertHardcopy','off','Color',[1 1 1]);
set(figACT,'Units', 'inches','Position',[2 3 4.5 7])
Yf = [0.05 0.2 0.35 0.5 0.65];
Xf = [0.1];
Wf = 0.7;
Hf = 0.15;
LevelLister1 =[-0.1 -0.0875 -0.075 -0.05 -0.025 0.025 0.05 -0.075 0.0875 0.1];
LevelLister2 =[-0.075 -0.05 -0.025 -0.0125 0.0125 0.025 0.05 -0.075];
fig_fs = 10
for i=1:size3
axes(i) = axes('Position',[Xf(1) Yf(i) Wf Hf],'Parent',figACT);
set(axes(i), 'fontsize',fig_fs)
set(gca, 'FontSize',fig_fs);
cc = [-0.1:0.1/5:0.1];
cc(floor(length(cc)/2)+1) = [];
contourf(Zg,Yg,V_dist(:,:,i),30, 'linestyle','none');
hold on
[C,h] = contour(Zg,Yg,V_dist(:,:,i),cc,'k');
end

Accedi per commentare.

Risposte (1)

Steven Lord
Steven Lord il 16 Ago 2019
I suspect you have a variable named set (or maybe one named axes) in your workspace that's taking precedence over the built-in set or axes functions. Rename or remove that variable.

Categorie

Scopri di più su Contour Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by