How to plot the image into a GUI?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Dear all,
I have this code:
function varargout = GUI_projekt1(varargin)
% GUI_PROJEKT1 MATLAB code for GUI_projekt1.fig
% GUI_PROJEKT1, by itself, creates a new GUI_PROJEKT1 or raises the existing
% singleton*.
%
% H = GUI_PROJEKT1 returns the handle to a new GUI_PROJEKT1 or the handle to
% the existing singleton*.
%
% GUI_PROJEKT1('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in GUI_PROJEKT1.M with the given input arguments.
%
% GUI_PROJEKT1('Property','Value',...) creates a new GUI_PROJEKT1 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before GUI_projekt1_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to GUI_projekt1_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 GUI_projekt1
% Last Modified by GUIDE v2.5 19-Oct-2016 11:10:48
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @GUI_projekt1_OpeningFcn, ...
'gui_OutputFcn', @GUI_projekt1_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 GUI_projekt1 is made visible.
function GUI_projekt1_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 GUI_projekt1 (see VARARGIN)
% Choose default command line output for GUI_projekt1
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes GUI_projekt1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = GUI_projekt1_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 (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
[filename pathname]=uigetfile({'*.trc'}, 'File Selector');
fullpathname=strcat(pathname, filename);
data=fopen(fullpathname); %otevreni datoveho souboru
a=fread(data);
save a;
% fseek(data,0,'eof');
% delka=ftell(data)%delka zaznamu
fseek(data,6,-1);
ms=fread(data,1,'int16');%cas v miisekundaach
fvz=fread(data,1,'int16');%vzorkovaci frekvence
fseek(data,182,-1);
adresa=fread(data,1,'int16');%pocatek dat
fseek(data,2,-1);
pocet=fread(data,1,'int16');%pocatek zaznamu
fseek(data,14,-1);
nazvy=fread(data,pocet+2,'int16');%nazvy merenych kanalu
kolik=ms/1000*fvz;%pocet vzorku v jednom zaznamu
% info o pacientovi
% mesic, den, rok , hodina, minuta a sekunda porizeni eeg
fseek(data,186,-1);
mesic=fread(data,1,'uint8');
den=fread(data,1,'uint8');
rok=fread(data,1,'uint8');
hodina=fread(data,1,'uint8');
minuta=fread(data,1,'uint8');
sekunda=fread(data,1,'uint8');
% od 192-prijmeni 22, jmeno 20, datum narozeni 3- mesic,den, rok
fseek(data,192,'bof');
prijmeni=fread(data,22,'uint8=>char')'
jmeno=fread(data,20,'uint8=>char')'
narozeni=fread(data,3,'uint8')'
set(handles.text1,'String', prijmeni)
set(handles.text1,'String', jmeno)
set(handles.text1,'String', narozeni)
fseek(data,adresa,-1);
i=1;
pole(i ,:)=(fread(data,pocet))';
while (i<kolik)
i=i+1;
fseek(data,adresa+i*pocet,-1);
pole(i ,:)=(fread(data,pocet))';
end
% seznam nazvu kanalu
popis={'GND or AVG' 'FP1' 'FP2' 'F3' 'F4' 'F7' 'F8' 'FZ' 'C3' 'C4' 'CZ' 'P3' 'P4' 'PZ' 'O1' 'O2' 'T3' 'T4' 'T5' 'T6' 'EOG' 'EMG' 'ECG' 'PNG' 'AUX' 'MKR' 'GNDp'};
i=1;
obr=figure(1);
%axes1 = axes('YTickLabel',{},'YTick',zeros(1,0));
axes('Xlim',[0 20],'Ylim',[125 pocet*100+225],'XTick',0:5:(kolik-1)/fvz+1,'YTick',225:100:pocet*100+200,'YTickLabelMode','manual','YTickLabels',popis(nazvy(1:pocet)+1)) % popisky osy y,x
box('on');
hold('all');
set(obr,'numbertitle','off'); % zapnout/vypnot popisek
set(obr,'name','EEG'); % titulek obrazku
set(obr,'menubar','none'); % bez vyberoveho menu
grid off;%vypnuta mrizka
xlabel(' \rightarrow čas[s]');%popis osy x
ylabel(' \rightarrow kanal');%popis osy y
t=0:1/fvz:(kolik-1)/fvz;%rozsah x osy
while (i<=pocet)
%text(20,i*100+125,popis(nazvy(i)+1));
plot(t,pole(:,i)'+100*i,'b');
i=i+1;
end
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
cla reset;
set(handles.text1,'Value', 0);
set(handles.pushbutton1,'Value', 0);
set(handles.pushbutton2,'Value', 0);
close EEG
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I want to figure into GUI. Not separately figure and GUI. Thank you
0 Commenti
Risposte (1)
Walter Roberson
il 19 Ott 2016
Create an appropriate axes in GUIDE. Then replace
obr=figure(1);
with
axes( handle.TheTagForTheAxes );
to make that the current axes to plot into.
0 Commenti
Vedere anche
Categorie
Scopri di più su Graphics Object Properties in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!