How to create a contourf plot form a structure with 16 fields?
2 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Prudhvi Peddagoni
on 1 Sep 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.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!