Combining Graphs into one Figure
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to combine 2 figure into 1. Even though I am using the hold command I still get 2 figures. I am extracting data from excel. I have also attached the excel table. I want to be able to compare the two figures so they need to be on top of each other. Can anyone help?
%% Part 1
%: Read the excel file using readtable function
rawTable = readtable('E.xlsx');
x = rawTable.x; %: get the excel column, Header1 (header name)
y = rawTable.B1; %: get the excel column, Header2 (header name)
figure;
plot(x,y);
title('Symmetric Inductor Susceptance vs. Iris Dimension')
hold on
x = rawTable.x2; %: get the excel column, Header1 (header name)
y = rawTable.B2; %: get the excel column, Header2 (header name)
figure;
plot(x,y);
hold off
0 commentaires
Réponses (1)
Dave B
le 18 Oct 2021
Modifié(e) : Dave B
le 18 Oct 2021
The command figure makes a new figure, so just remove the second call to figure and you should be in good shape!
%% Part 1
%: Read the excel file using readtable function
rawTable = readtable('E.xlsx');
x = rawTable.x; %: get the excel column, Header1 (header name)
y = rawTable.B1; %: get the excel column, Header2 (header name)
figure;
plot(x,y);
title('Symmetric Inductor Susceptance vs. Iris Dimension')
hold on
x = rawTable.x2; %: get the excel column, Header1 (header name)
y = rawTable.B2; %: get the excel column, Header2 (header name)
% Don't call figure again here!
plot(x,y);
hold off
0 commentaires
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!