Creating an interface with Guide

조회 수: 10 (최근 30일)
Enrica Brunetti
Enrica Brunetti 2019년 8월 18일
편집: Adam Danz 2019년 8월 23일
How to insert in Matlab code for example the data of a vector in function of time to create an immage with the icon "axes"?
for example a vector h = [67, 32, 67, 87, 45, 89];
time : t = 1:6;
when I use Guide, then Blank GUI, then Axes, I have this general code:
function varargout = untitled1(varargin)
% UNTITLED1 MATLAB code for untitled1.fig
% UNTITLED1, by itself, creates a new UNTITLED1 or raises the existing
% singleton*.
%
% H = UNTITLED1 returns the handle to a new UNTITLED1 or the handle to
% the existing singleton*.
%
% UNTITLED1('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in UNTITLED1.M with the given input arguments.
%
% UNTITLED1('Property','Value',...) creates a new UNTITLED1 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before untitled1_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to untitled1_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help untitled1
% Last Modified by GUIDE v2.5 18-Aug-2019 19:28:36
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @untitled1_OpeningFcn, ...
'gui_OutputFcn', @untitled1_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before untitled1 is made visible.
function untitled1_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to untitled1 (see VARARGIN)
% Choose default command line output for untitled1
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes untitled1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = untitled1_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (seguie GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
How to insert my new data to create that interface??
  댓글 수: 3
Enrica Brunetti
Enrica Brunetti 2019년 8월 18일
How to create an axis for plotting from Guide?
The data is imported as new variable in matlab code.
Adam Danz
Adam Danz 2019년 8월 18일
편집: Adam Danz 2019년 8월 23일
Open your GUI with guide.
guide('yourGui')
From the interface, add the axes.

댓글을 달려면 로그인하십시오.

채택된 답변

Bhargavi Maganuru
Bhargavi Maganuru 2019년 8월 21일
You can add following code in OpeningFcn callback for creating a plot
h = [67, 32, 67, 87, 45, 89];
t = 1:6;
axes(handles.axes1);
plot(t,h);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by