From: nurul on
hello everyone,

im new to matlab gui and i have a question to ask. i think the problem is easy. but o dont know how to solve it.
i have created an interface for a system.
it has 2 pushbutton, 1 edit text, and one static text.
the 1st pushbutton i assigned it go get a file(.wav) by using uigetfile.
and show the name of the file in the edit box.

---> my problem is, i want the second pushbutton to recognize the file in the edit box, calculate and verify the type of the file.
i have this block of code to verify the files.

%1st pushbutton
function Selection_Callback(hObject, eventdata, handles)
[filename,pathname] = uigetfile({'*.wav';'*.txt';'*.jpg'},'pick a file')
set(handles.edit1,'String',{filename},'Value',1)
guidata(hObject,handles)

%edit text
function edit1_Callback(hObject, eventdata, handles)
a = num2str(get(handles.Selection,'String',{filename}));
set(handles.edit1,'String') = a;
guidata(hObject,handles)

2nd pushbutton
function verify_Callback(hObject, eventdata, handles)

% load all related file for comparison function
load ('np1-20mfcc5st8mix50ms.mat');
load ('np2-20mfcc5st8mix50ms.mat');
load ('np3-20mfcc5st8mix50ms.mat');
load ('np4-20mfcc5st8mix50ms.mat');
load ('np5-20mfcc5st8mix50ms.mat');
load ('pp1-20mfcc5st8mix50ms.mat');
load ('pp2-20mfcc5st8mix50ms.mat');
load ('pp3-20mfcc5st8mix50ms.mat');
load ('pp4-20mfcc5st8mix50ms.mat');
load ('pp5-20mfcc5st8mix50ms.mat');
load ('TESTNONPAIN20MFCC50ms.mat');
load ('TESTPAIN20MFCC50ms.mat');

b = get(handles.edit1,'String'); %get data from editbox

%comparison function
testlogliknpVSp=mhmm_logprob(b(:,:),priornp,transmatnp,munp,Sigmanp,mixmatnp);%NOPAIN MODEL
testloglikpVSp=mhmm_logprob(b(:,:),priorp,transmatp,mup,Sigmap,mixmatp); %PAIN MODEL
if testloglikpVSp > testlogliknpVSp
set(handles.verification,'String','this cry belongs to pain class')%setting to static text
else
set(handles.verification,'String','this cry belongs to no pain class')%setting to static text
end
guidata(hObject,handles)


for your info, it work fine when i run it from matlab command window.
but i get error when i try to combine with the gui.it says

Error in ==> gaussian_prob at 20
mahal = sum(((x-M)'*inv(C)).*(x-M)',2); % Chris Bregler's trick

Error in ==> mixgauss_prob at 103
B2(j,k,:) = gaussian_prob(data, mu(:,j,k), Sigma(:,:,j,k));

Error in ==> mhmm_logprob at 24
obslik = mixgauss_prob(data{m}, mu, Sigma, mixmat);

Error in ==> file2>verify_Callback at 96
testlogliknpVSp=mhmm_logprob(b(:,:),priornp,transmatnp,munp,Sigmanp,mixmatnp);%NOPAIN MODEL


any help would be much appreciated. thank you in advance.