概述
我的问题是这样的:我从listbox中选择一个项,双击,希望能把点击的文件(前提当然是wav文件)读入至矩阵中,我用的是如下的方法,不知道为什么不对,大概的代码是这样的。
function listbox_callback(hObject,eventdata,handles)
get(handles.figure1,'SelectionType');
index_selected = get(handles.listbox,'Value');
file_list = get(handles.listbox,'String');
...
%下面就是我出错的地方了
if strcmp(get(handles.figure1,'SelectionType'),'open')%代表双击
[data,fs,bits] = wavread(file_list{index_selected});
end
错误提示为:
Warning: Inputs must be character arrays or cell arrays of strings.
> In fileparts at 32
In wavread>open_wav at 162
In wavread at 52
In SimpleSimuPlatform>display at 315
In SimpleSimuPlatform>SimpleSimuPlatform_OpeningFcn at 58
In gui_mainfcn at 153
In SimpleSimuPlatform at 44
??? Error using ==> strrep
Conversion to double from struct is not possible.
Error in ==> fileparts at 32
name = strrep(name,'/','');
Error in ==> wavread>open_wav at 162
[pat,nam,ext] = fileparts(file);
Error in ==> wavread at 52
[fid,msg] = open_wav(file);
Error in ==> SimpleSimuPlatform>display at 315
[data,fs,bits]=wavread(filename);
Error in ==> SimpleSimuPlatform>SimpleSimuPlatform_OpeningFcn at 58
handles.output = hObject
Error in ==> gui_mainfcn at 153
feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});
Error in ==> SimpleSimuPlatform at 44
gui_mainfcn(gui_State, varargin{:});
不知道我问题阐述的大家明白了没,希望知道的给我个提醒,谢谢了
最后
以上就是明亮月饼为你收集整理的wav用matlab打不开,Matlab如何读取wav文件,为什么wavread不行啊的全部内容,希望文章能够帮你解决wav用matlab打不开,Matlab如何读取wav文件,为什么wavread不行啊所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复