필터 지우기
필터 지우기

GUI data sharing problem?

조회 수: 2 (최근 30일)
Daud
Daud 2012년 12월 1일
i want to load a mat file which contains neural network object file using a pushbutton; but the problem is after using uigetfile command; i don't know how to use it or share it among different gui callbacks.
Plz tell me the next steps to share among different callbacks.

답변 (2개)

Matt Fig
Matt Fig 2012년 12월 1일
Put the call to UIGETFILE in the callback for the pushbutton. Then immediately after the return, simply use the open the file as usual.
  댓글 수: 2
Daud
Daud 2012년 12월 1일
here is my code;
Plz tell me whats wrong: I am new to GUI (programming); i want to load a "net0" named varialble and use it in other callback function "Rcrd_and_Recog".
Note: i am not using GUIDE GUI; using programming GUI.
function ASR()
figure('Name','Automatic Isolated Speech Rcognition System',.......
'Menubar','none',........
'Color',[1 1 1]);
Rcrd_and_Recog =uicontrol('Style','pushbutton',....
'Units','normalized',....
'Position',[0.75 0.75 0.20 0.05],....
'String','START',....
'Callback',@Record_Recog);
LD_net = uicontrol('Style','pushbutton',....
'Units','normalized',....
'Position',[0.75 0.65 0.20 0.05],....
'String','LOAD THE NET',....
'Callback',@load_net);
function load_net(varargin)
[file path]=uigetfile('*.mat','Select the M-file');
if ~isequal(file, 0)
L=load(fullfile(path,file));
handles.net=L;
end
function Record_Recog(varargin)
fs=16000;
y=wavrecord(1*fs,fs,1,'double');
if length(y)<1157
result=sim(net0,cat(1,y,zeros(1157-length(y),1)))
else
result=sim(net0,y)
end
end
Daud
Daud 2012년 12월 1일
편집: Daud 2012년 12월 1일
Another query came to my mind:
Is it possible to load and use a neural network object file in "gui" local function?

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


Image Analyst
Image Analyst 2012년 12월 1일
Refer to the FAQ for several methods to share variables outside of their own local function, which is usually only where they are in scope. http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by