Info
此问题已关闭。 请重新打开它进行编辑或回答。
Can anyone pls help me with the following code;
1 次查看(过去 30 天)
显示 更早的评论
choice=input('enter a no.to be recognized:no.1 for trained words,no.2 for not trained words:');
if choice==1)
[pathname,filename]=uigetfile('*.wav','Select a wave file');
current=strcat(filename,pathname);
input=wavread(current);
disp('y');
else
disp('n');
end
when i give input as 1,then it must enter into 'if'loop or else it should enter into else condition.
0 个评论
回答(1 个)
Harry
2014-11-2
Your code is mostly correct, just remove the ")" at the end of your 'if' statement:
if choice==1
2 个评论
Harry
2014-11-3
编辑:Harry
2014-11-3
Ah yes, your problem is that you have named a variable "input"... but you also need to use a function called "input".
Therefore, when you create the variable input=wavread(current), this means you can't call the function choice=input(...) any more.
The easy solution is to rename your variable "input". For example, try this:
choice=input('enter a no.to be recognized:no.1 for trained words,no.2 for not trained words:');
if choice==1
[pathname,filename]=uigetfile('*.wav','Select a wave file');
current=strcat(filename,pathname);
wave=wavread(current);
disp('y');
else
disp('n');
end
In the future, you should always clear all your variables at the start of your code, using:
clear all;
This will prevent many problems like this from happening.
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!