How to combine 2 graphs from different scripts in another script
Show older comments
Hello everyone, I am trying to combine 2 graphs, ech made in a different script, in another script. I used the code written underneath. However when I run the code it gives an error that it can't find the figures that I made. Can someone tell me what I did wrong and how to make this work? Thanks in advance!
%graph 1
fg1 = figure;
hold on
plot(Q,h);
xlabel('Debiet[m³/s]');
ylabel('Opvoerhoogte [m]');
%graph 2 in another script
fig2 = figure;
hold on;
curve_head_debiet = plot(G_debiet_int,G_head_int);
curve_head_debie2_2 = plot(n_IP*G_debiet_int,G_head_int);
xlim([0 650]);
ylim([0 70]);
xlabel('Debiet [m³/h]');
ylabel('Head [m]');
%combined graph in another script
pompgrafiek = openfig("fg1.fig");
leidingsgrafiek = openfig("fg2.fig");
copyobj(get(gca(leidingsgrafiek),'Children'), gca(pompgrafiek));
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


