How do you convert this code to be able to plot in a gui not a separate plot outside of the gui?

8 views (last 30 days)
global runningAverage;
global datas;
%CREATEFIGURE(Y1,X1,Y2)
% Y1: vector of y data data
% X1: vector of x data x scale
% Y2: vector of y data average
% Auto-generated by MATLAB on 21-Jan-2012 13:11:48
x=0:135:17145;
% Create figure
figure1 = figure('XVisual','');
% Create axes
handles.axes1 = axes('Parent',figure1,'YMinorTick','on',...
'XTickLabel',{'19','20','21','22','23','24','0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18'},...
'XTick',[0 750 1500 2250 3000 3750 4500 5250 6000 6750 7500 8250 9000 9750 10500 11250 12000 12750 13500 14250 15000 15750 16500 17250 18000]);
box(handles.axes1,'on');
hold(handles.axes1,'all');
% Create xlabel
xlabel('Time (Hours)EST');
% Create ylabel
ylabel('VLF Wave Strenth');
% Create plot
plot(datas.data,'DisplayName','data');
% Create plot
plot(x,runningAverage,'Color',[1 0 0],'DisplayName','average');
% --------------------------------------------------------------------
function createfigure1()
%CREATEFIGURE1(S1)
% S1: vector of y data
global runCut;
% Auto-generated by MATLAB on 27-Jan-2012 16:10:57
% Create figure
figure1 = figure('XVisual','');
% Create axes
axes1 = axes('Parent',figure1,...
'XTickLabel',{'0','2.5','5','7.5','10','12.5','15'});
box(axes1,'on');
hold(axes1,'all');
% Create plot
plot(runCut,'DisplayName','s');
% Create xlabel
xlabel('Hours');
% Create title
title({'Super Sid Day Time Data',''});

Accepted Answer

Walter Roberson
Walter Roberson on 21 Feb 2012
Delete the line
figure1 = figure('XVisual','');
and instead pass in the figure number you want to use.

More Answers (1)

Walter Roberson
Walter Roberson on 24 Feb 2012
You have not parented all of your graphics operations.

Community Treasure Hunt

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

Start Hunting!