Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
char error

Subject: char error

From: Anil Firat

Date: 20 Oct, 2013 12:31:07

Message: 1 of 2

tone=note(keynum,dur)
 %This function produces sinusoidal waveform corresponding to given piano
 %key number
 %tone=output sinusoidal waveform
 %keynum= The piano keyboard number
 %dur= The duration in seconds of output note
 fs=8000;
 tt=0:(1/fs):dur;
 freq = 440 *(2^((keynum-49)/12));
 tone=note(40,1);
soundsc(tone,fs)

when write this code,I will see 'Undefined function or method 'note' for input arguments of type 'char'.' error,what I will do?

Subject: char error

From: dpb

Date: 20 Oct, 2013 14:58:03

Message: 2 of 2

On 10/20/2013 7:31 AM, Anil Firat wrote:
> tone=note(keynum,dur)
> %This function produces sinusoidal waveform corresponding to given piano
> %key number
> %tone=output sinusoidal waveform
> %keynum= The piano keyboard number
> %dur= The duration in seconds of output note
...

> when write this code,I will see 'Undefined function or method 'note' for
> input arguments of type 'char'.' error,what I will do?

Insert the missing 'function' keyword into the m-file...

m-file tone.m must contain...

function tone=note(keynum,dur)
% help stuff
   code
   ...

--

Tags for this Thread

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.

Contact us