I am getting error when i try to listen mat file
1 次查看(过去 30 天)
显示 更早的评论
Hi i am having mat file its name is sig.mat it is having dtmf tones in it
i m using
x=load('sig.mat');
soundsc(x,8000)
and i am getting error
??? Undefined function or method 'min' for input arguments of type 'struct'.
Error in ==> soundsc at 27 xmin = min(x(:));
0 个评论
采纳的回答
Wayne King
2011-10-31
Hi Moonman, what is x?
>>whos x
If it is a structure, then feed soundsc() the appropriate field
soundsc(x.data,8000)
or whatever the field is.
1 个评论
Wayne King
2011-10-31
for example if you tried:
x = struct('data',randn(1e3,1));
soundsc(x,8000)
You would get that error. But
soundsc(x.data,8000)
is fine
更多回答(3 个)
moonman
2011-10-31
1 个评论
Wayne King
2011-10-31
enter fieldnames(x) and see what you really want to listen to
Please see my comment above:
for example if you tried:
x = struct('data',randn(1e3,1));
soundsc(x,8000)
You would get that error. But
soundsc(x.data,8000)
is fine
moonman
2011-10-31
1 个评论
Wayne King
2011-10-31
That is not per my instructions. I was constructing a struct array as an example. You have entered:
x = load('sig.mat');
x is a structure array, you cannot play a structure array with soundsc(), you have to play a field of a structure array. Enter
fieldnames(x)
and see which part of x you really want to play.
Jan
2011-10-31
It seems to be nothing but non-trivial. Let me try it also, Wayne:
x = load('sig.mat');
f = fieldnames(x);
fprintf('%s\n', f{:}); % Just for information
soundsc(x.(f{1}), 8000);
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!