Thread Subject: filename as function argument

Subject: filename as function argument

From: Stephen Antonelli

Date: 19 Nov, 2008 04:53:02

Message: 1 of 5

hello all,
i have written a function that will import a .wav file for analysis using MATLAB's wavread funtion. I am trying to have the filename be an input to the function (in addition to the input arguments which so far have posed no problems) instead of hardcoding the filename into the function, but cannot seem to get this to work.

can anyone advise?

thanks much,
steve antonelli

Subject: filename as function argument

From: markym

Date: 19 Nov, 2008 11:15:22

Message: 2 of 5

Stephen Antonelli wrote:
> hello all,
> i have written a function that will import a .wav file for analysis using MATLAB's wavread funtion. I am trying to have the filename be an input to the function (in addition to the input arguments which so far have posed no problems) instead of hardcoding the filename into the function, but cannot seem to get this to work.

Just pass in a string variable containing the filename.

Subject: filename as function argument

From: Stephen Antonelli

Date: 21 Nov, 2008 23:47:02

Message: 3 of 5

markym <no@email.com> wrote in message <gg0sg8$6dq$2@news.oulu.fi>...

i cant seem to get it. perhaps it is the syntax?
i have [outs] = func(in1,in2,in3,filename)

but when the function tries to run with the file tuned.wav i get:
??? Undefined function or variable "tuned.wav".

Subject: filename as function argument

From: Matthew Whitaker

Date: 22 Nov, 2008 00:13:01

Message: 4 of 5

"Stephen Antonelli" <antone@cooper.edu> wrote in message <gg7h9m$4mu$1@fred.mathworks.com>...
> markym <no@email.com> wrote in message <gg0sg8$6dq$2@news.oulu.fi>...
>
> i cant seem to get it. perhaps it is the syntax?
> i have [outs] = func(in1,in2,in3,filename)
>
> but when the function tries to run with the file tuned.wav i get:
> ??? Undefined function or variable "tuned.wav".
>


Are you passing the filename in quotes???
filename = 'somefile.wav';
 [outs] = func(in1,in2,in3,filename)

Subject: filename as function argument

From: Stephen Antonelli

Date: 22 Nov, 2008 01:27:01

Message: 5 of 5

thanks everyone, your suggestions worked. i apreciate the help

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
wave Stephen Antonelli 18 Nov, 2008 23:55:04
input Stephen Antonelli 18 Nov, 2008 23:55:04
argument Stephen Antonelli 18 Nov, 2008 23:55:04
filename Stephen Antonelli 18 Nov, 2008 23:55:04
function Stephen Antonelli 18 Nov, 2008 23:55:04
wavread Stephen Antonelli 18 Nov, 2008 23:55:04
string Stephen Antonelli 18 Nov, 2008 23:55:04
wav Stephen Antonelli 18 Nov, 2008 23:55:04
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com