Error checking in matlab
2 views (last 30 days)
Show older comments
I am new to matlab. In other programming softwares when you get error they will tell you where the error is and what is the error so you can search it in internet. On the other hand in matlab i am using live script to write a program it does tell me which line has error but i could not find out what the error is so i can search about it. Is there any error window or way to check error discription. my code is given below it says line 11 has an error in command window
[file, path] = uigetfile('*.wav','Select a .wav file');
if file == 0
return
end
out_dir = uigetdir(cd,'Choose output folder');
if out_dir == 0
return;
end
[y,Fs,nbits]= audioread(file);
if size(y,2) == 1
msgbox('The selected file is Mono. This algorithm is applicable only for Stereo files.');
return;
end
fc=input('Enter Cutoff Frequency (HPF):');
fc=round(fc);
if fc > 20
fp = fc+5;
fs = fc/(Fs/2);
fp = fp/(Fs/2);
[n, wn] = buttord(fp,fs,0.5,80);
[b, a] = butter(5,wn,'High');
channel_2 = filtfilt(b,a,y(:,2));
else
channel_2 = y(:,2);
end
karaoke_wav = y(:,1) - channel_2;
%Write it to a file
[p, name, ext] = fileparts(file);
if isfolder(out_dir)
audiowrite(karaoke_wav,Fs,nbits,[out_dir '\' name ext]);
else
audiowrite(karaoke_wav,Fs,nbits,[cd '\' name ext]);
end
2 Comments
John D'Errico
on 31 Dec 2020
MATLAB does return error messages.
You tell us it does not say what the error is? When you get an error, the only way for us to know what it was is if you report the ENTIRE text of the error message, thus everything in red.
Walter Roberson
on 31 Dec 2020
If you have the editor docked then the error message may have scrolled up past what is visible and you may need to scroll back.
Answers (0)
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!