From: Walter Roberson on 25 Jul 2010 21:02 nurul wrote: > owh. hehe. how do i pass the content? > i use evalin. so it means it didnt work(but when i test, it seems to > reading). can u give me rough idea on the codes how to pass the > variable/content please? thank you.. I think you should show the relevant part of your code.
From: us on 25 Jul 2010 21:10 "nurul " <epal_sakura(a)yahoo.com> wrote in message <i2ikl2$fm2$1(a)fred.mathworks.com>... > thank you so much jan.. > > > can i ask, one more thing? > > by right, i have loaded the mat files, its working and read the variables in the workspace. > and i have an input(wav file) to be verified, therefore , i assign it to the function to execute the calculation. but then, it says the input is not a scalar. therefore, i make the variable as a scalar, and it says matrix dimension must agree. > any idea why does this happening? well... not without a bit of ML code... us
From: nurul on 25 Jul 2010 21:49 hehe.. changed of mind. i didnt use evalin anymore. just using simple loading style. like this load ('np1-20mfcc5st8mix50ms.mat','priornp'); load ('np2-20mfcc5st8mix50ms.mat','transmatnp'); load ('np3-20mfcc5st8mix50ms.mat','munp'); load ('np4-20mfcc5st8mix50ms.mat','Sigmanp'); load ('np5-20mfcc5st8mix50ms.mat','mixmatnp'); load ('pp1-20mfcc5st8mix50ms.mat','priorp'); load ('pp2-20mfcc5st8mix50ms.mat','transmatp'); load ('pp3-20mfcc5st8mix50ms.mat','mup'); load ('pp4-20mfcc5st8mix50ms.mat','Sigmap'); load ('pp5-20mfcc5st8mix50ms.mat','mixmatp'); load ('PAIN20MFCC50ms','data_pain1'); load ('NONPAIN20MFCC50ms','data_nonpain1'); and i execute this : testlogliknpVSnp=zeros(handles.Fs,1); testloglikpVSnp=zeros(handles.Fs,1); for i=1:handles.Fs testlogliknpVSp(i)=mhmm_logprob(data_pain1(i),priornp,transmatnp,munp,Sigmanp,mixmatnp);%NOPAIN MODEL testloglikpVSp(i)=mhmm_logprob(data_pain1(i),priorp,transmatp,mup,Sigmap,mixmatp); %PAIN MODEL if testloglikpVSp(i) > testlogliknpVSp(i) set(handles.verification,'String','this cry belongs to pain class') testlogliknpVSnp(i)=mhmm_logprob(data_nonpain1(i),priornp,transmatnp,munp,Sigmanp,mixmatnp);% non-pain model testloglikpVSnp(i)=mhmm_logprob(data_nonpain1(i),priorp,transmatp,mup,Sigmap,mixmatp); % pain model if testlogliknpVSnp(i)> testloglikpVSnp(i) set(handles.verification,'String','this cry belongs to no pain class'); end end end and now, new error, it prompt: index exceed matrix dimension. knows whats solution for this? :)
From: Steven_Lord on 26 Jul 2010 00:03 "nurul " <epal_sakura(a)yahoo.com> wrote in message news:i2ipif$nkf$1(a)fred.mathworks.com... > hehe.. changed of mind. i didnt use evalin anymore. just using simple > loading style. like this > > load ('np1-20mfcc5st8mix50ms.mat','priornp'); Instead of doing this, I recommend that you call LOAD with an output argument. Then you can either create variables that contain the contents of the fields of that struct array, or you can directly refer to the fields themselves in your code. *snip* > and now, new error, it prompt: index exceed matrix dimension. > knows whats solution for this? :) Yes -- debugging. Set a breakpoint in your code (or use the "Stop if Errors/Warnings" item on the Debug menu) and run your code, then determine where you're trying to index into an array using an index that's too large. Once you know _where_ the problem lies, you can work on figuring out how to fix it. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: nurul on 26 Jul 2010 03:51 steve, now the error has gone. thank you. but i my code did not work properly. this is my full code. **frankly, i dont know how to load with output argument. hehe. thats why im sticking with --> load ('np1-20mfcc5st8mix50ms.mat','priornp');** function varargout = file2(varargin) % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @file2_OpeningFcn, ... 'gui_OutputFcn', @file2_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 file2 is made visible. function file2_OpeningFcn(hObject, eventdata, handles, varargin) handles.output = hObject; handles.fileloaded = 0; % Update handles structure guidata(hObject, handles); % --- Outputs from this function are returned to the command line. function varargout = file2_OutputFcn(hObject, eventdata, handles) varargout{1} = handles.output; % --- Executes on button press in Selection. function Selection_Callback(hObject, eventdata, handles) [filename,pathname] = uigetfile({'*.wav'},'pick a file'); set(handles.edit1,'String',{filename},'Value',1) [x,Fs] = wavread([pathname '/' filename]); % handles.x = x ./ max(abs(x)) handles.Fs = Fs fileloaded = 1 guidata(hObject,handles) function edit1_Callback(hObject, eventdata, handles) a = num2str(get(handles.Selection,'String',{filename})); set(handles.edit1,'String') = a; guidata(hObject,handles) % --- Executes during object creation, after setting all properties. function edit1_CreateFcn(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in verify. function verify_Callback(hObject, eventdata, handles) % hObject handle to verify (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) load ('np1-20mfcc5st8mix50ms.mat','priornp'); load ('np2-20mfcc5st8mix50ms.mat','transmatnp'); load ('np3-20mfcc5st8mix50ms.mat','munp'); load ('np4-20mfcc5st8mix50ms.mat','Sigmanp'); load ('np5-20mfcc5st8mix50ms.mat','mixmatnp'); load ('pp1-20mfcc5st8mix50ms.mat','priorp'); load ('pp2-20mfcc5st8mix50ms.mat','transmatp'); load ('pp3-20mfcc5st8mix50ms.mat','mup'); load ('pp4-20mfcc5st8mix50ms.mat','Sigmap'); load ('pp5-20mfcc5st8mix50ms.mat','mixmatp'); load ('PAIN20MFCC50ms','data_pain1'); load ('NONPAIN20MFCC50ms','data_nonpain1'); % apply testing testlogliknpVSp(handles.x)=mhmm_logprob(data_nonpain1(handles.x),priornp,transmatnp,munp,Sigmanp,mixmatnp);%NOPAIN MODEL testloglikpVSp(handles.x)=mhmm_logprob(data_pain1(handles.x),priorp,transmatp,mup,Sigmap,mixmatp); %PAIN MODEL if testlogliknpVSp(handles.x) < testloglikpVSp(handles.x) fprintf(' %6.2f %6.2f',testlogliknpVSp(handles.x),testloglikpVSp(handles.x)) set(handles.verification,'String','this cry belongs to no pain class'); else fprintf(' %6.2f %6.2f',testlogliknpVSp(handles.x),testloglikpVSp(handles.x)) set(handles.verification,'String','this cry belongs to pain class'); end guidata(hObject,handles) doesnt matter either pain or not pain wav file(**assuming we know which is pain or not pain audio track), the result sticking with 'this cry belongs to pain class'
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: loading mat file problem Next: Arduino Matlab Integration |