Subplots Saveas Function Problem

2 ビュー (過去 30 日間)
Sérgio Querido
Sérgio Querido 2017 年 9 月 12 日
回答済み: Sérgio Querido 2017 年 9 月 13 日
Hello,
I did this graph configuration in Property Editor and generated the code. In my code i run it as follows:
X1=[1:6]
Y1=hsd
Y2=hi
Y3=td
Y4=ratio
graph(X1,Y1,Y2,Y3,Y4)
This is the final graph.
How can i save it automatically as a png format with saveas??
Example:
graphwrite=[[Filename],'fisico','.png'];
saveas(...,graphwrite)

採用された回答

Sérgio Querido
Sérgio Querido 2017 年 9 月 13 日
solved
graphwrite=[[Filename],'fisico','.png'];
saveas(gcf,graphwrite)

その他の回答 (4 件)

KL
KL 2017 年 9 月 12 日
g1 = graph(X1,Y1,Y2,Y3,Y4);
saveas(g1,'filename.png')

Sérgio Querido
Sérgio Querido 2017 年 9 月 12 日
Always de same error!!
Error using graph Too many output arguments.
  2 件のコメント
Walter Roberson
Walter Roberson 2017 年 9 月 12 日
Please show the output for
which -all graph
Sérgio Querido
Sérgio Querido 2017 年 9 月 12 日
See the comments below

サインインしてコメントする。


Sérgio Querido
Sérgio Querido 2017 年 9 月 12 日
function createfigure(X1, Y1, Y2, Y3, Y4)
%CREATEFIGURE(X1, Y1, Y2, Y3, Y4)
% X1: vector of x data
% Y1: vector of y data
% Y2: vector of y data
% Y3: vector of y data
% Y4: vector of y data
% Auto-generated by MATLAB on 12-Sep-2017 10:29:32
% Create figure
figure1 = figure;
% Create subplot
subplot1 = subplot(2,2,1,'Parent',figure1,...
'XTickLabel',{'Início','15''','30''','Intervalo','60''','75''','Final'},...
'XTick',[0 1 2 3 4 5 6]);
%%Uncomment the following line to preserve the X-limits of the axes
% xlim(subplot1,[1 6]);
box(subplot1,'on');
hold(subplot1,'on');
% Create plot
plot(X1,Y1,'ZDataSource','','Parent',subplot1,'Color',[1 0 0]);
% Create title
title('Gráfico 1 - HSD');
% Create subplot
subplot2 = subplot(2,2,2,'Parent',figure1,...
'XTickLabel',{'15''','30''','Intervalo','60''','75''','Final'},...
'XTick',[1 2 3 4 5 6]);
%%Uncomment the following line to preserve the X-limits of the axes
% xlim(subplot2,[1 6]);
box(subplot2,'on');
hold(subplot2,'on');
% Create plot
plot(X1,Y2,'Parent',subplot2,...
'Color',[0.929411768913269 0.694117665290833 0.125490203499794]);
% Create title
title('Gráfico 2 - HI');
% Create subplot
subplot3 = subplot(2,2,3,'Parent',figure1,...
'XTickLabel',{'15''','30''','Intervalo','60''','75''','Final'},...
'XTick',[1 2 3 4 5 6]);
%%Uncomment the following line to preserve the X-limits of the axes
% xlim(subplot3,[1 6]);
box(subplot3,'on');
hold(subplot3,'on');
% Create plot
plot(X1,Y3,'Parent',subplot3,'Color',[0 1 0]);
% Create title
title('Gráfico 3 - TD');
% Create subplot
subplot4 = subplot(2,2,4,'Parent',figure1,...
'XTickLabel',{'15''','30''','Intervalo','60''','75''','Final'},...
'XTick',[1 2 3 4 5 6]);
box(subplot4,'on');
hold(subplot4,'on');
% Create plot
plot(X1,Y4,'Parent',subplot4,'Color',[0 0 0]);
% Create title
title('Gráfico 4 - W/R Ratio');
end

Sérgio Querido
Sérgio Querido 2017 年 9 月 12 日
X1 =
1 2 3 4 5 6
Y1 =
26.0902 42.9149 43.8763 94.0833 14.7254 54.5473
Y2 =
115.9783 60.0937 139.7268 109.1997 108.5510 116.0662
Y3 =
1.0e+03 *
1.8353 1.7153 2.0605 1.8815 1.6531 1.3510
Y4 =
0.8446 0.7564 0.7606 1.0158 0.7379 1.1439

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by