How to create a contourf plot form a structure with 16 fields?

1 visualización (últimos 30 días)
Carolin Widmann
Carolin Widmann el 29 de Ag. de 2020
Respondida: Prudhvi Peddagoni el 1 de Sept. de 2020
Hi everyone,
I have a structure with 16 fields for x,y, and u.
I want to create one contourf plot for the whole structure. How can I do this?
files = dir('Desktop\Daten\*.mat');
level2 = load([files.folder '/' files.name]);
for i = 1:16
x= level2.data(i).x;
y= level2.data(i).y;
u= level2.data(i).u;
Werte= struct('x',x,'y',y,'u',u);
figure;
hold on;
grid on;
[C,h] = contourf(Werte.x,Werte.y,Werte.u);
end
When I do it like this I get 16 different plots with different x-axes.
But I want a superposition.

Respuestas (1)

Prudhvi Peddagoni
Prudhvi Peddagoni el 1 de Sept. de 2020
Hi Carolin Widmann,
It seems that you are creating new figure for every iteration by calling figure function. Call this function before entering for loop so that only one figure is created and the hold on function will make sure that each new plot is added to the same figure.
Hope this helps.

Community Treasure Hunt

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

Start Hunting!