File Read/Write problems

조회 수: 3 (최근 30일)
Masab Ahmad
Masab Ahmad 2012년 2월 12일
편집: Cedric 2013년 10월 9일
Hi all, I'm having a simple code problem ,here is the code:
% create an example sound
t = 0:0.0001:3;
x = 0.9*cos(2*pi*440*t);
% play it back
sound(x, 8000);
wavwrite(x, 8000, 16, example_sound.wav);_
it gives an error :
Error in ==> play123 at 6 wavwrite(x, 8000, 16, example_sound.wav);
plz help! I'm also having similar problems with image processing (i also have all the requires toolboxes)
  댓글 수: 2
Jan
Jan 2012년 2월 12일
You've posted the line, where the error appears, but not the descrption of the problem.
Image Analyst
Image Analyst 2012년 2월 12일
What is the image processing problem? Why don't you post a separate question on that, if you still have problems that enclosing the filename in quotes did not fix?

댓글을 달려면 로그인하십시오.

답변 (2개)

Jan
Jan 2012년 2월 12일
I guess, that you did not store the file name in a struct called example_sound in the field wav, but you want to use this as a file name. Then it must be defined as a string using quotes:
wavwrite(x, 8000, 16, 'example_sound.wav')

Masab Ahmad
Masab Ahmad 2012년 2월 13일
thats solved the problem, thanks!
  댓글 수: 1
Jan
Jan 2012년 2월 13일
@Massab: Please accept the answer to show, that your problem is solved. Comments to answers should be posted as comments, not as additional answers. Thanks.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by