Combining Graphs into one Figure
9 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Dave B
2021 年 10 月 18 日
編集済み: Dave B
2021 年 10 月 18 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!