Thread Subject: Problem with calling a function

Subject: Problem with calling a function

From: Nasser Abbasi

Date: 6 Jul, 2008 12:14:57

Message: 1 of 3


"Hailey Yang" <haileyyang@hotmail.com> wrote in message
news:g4o9e9$dfe$1@fred.mathworks.com...
>I have problem with calling the following function by
> command mode:
>
> function z = touzi(capacity)
>
> z=capacity+10000;
>
> When I do the following in the command window:
>
> capacity=200000
> touzi capacity
>

Is this call synatx part of new Matlab 2008a?

should'nt you do

 touzi(capacity)

?

Nasser

Subject: Problem with calling a function

From: Bruno Luong

Date: 6 Jul, 2008 12:43:03

Message: 2 of 3

"Nasser Abbasi" <nma@12000.org> wrote in message
<9H2ck.31486$ZE5.1252@nlpi061.nbdc.sbc.com>...



> > touzi capacity
> >
>
> Is this call synatx part of new Matlab 2008a?
>

No. It exists long ago probably from the first MATLAB


> touzi capacity

is equivalent to

touzi('capacity')

Common example are 'load', 'print' command

For example when you do

> load -ascii data.txt

is exactly like

load('-ascii','data.txt')

Bruno

Subject: Problem with calling a function

From: Steven Lord

Date: 8 Jul, 2008 14:25:29

Message: 3 of 3


"Bruno Luong" <b.luong@fogale.fr> wrote in message
news:g4qekm$qsd$1@fred.mathworks.com...
> "Nasser Abbasi" <nma@12000.org> wrote in message
> <9H2ck.31486$ZE5.1252@nlpi061.nbdc.sbc.com>...
>
>
>
>> > touzi capacity
>> >
>>
>> Is this call synatx part of new Matlab 2008a?
>>
>
> No. It exists long ago probably from the first MATLAB

Yes, this has been part of MATLAB for a long time.

There are two ways to invoke most functions in MATLAB, the command form and
the functional form.

>> touzi capacity
>
> is equivalent to
>
> touzi('capacity')

Yes. This is known as "command-function duality".

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f7-58170.html

> Common example are 'load', 'print' command

Another common example (although not always as common as I'd like, and I'm
guessing few people think of it this way) is HELP.

"help sin" is the same as "help('sin')".

--
Steve Lord
slord@mathworks.com

Tags for this Thread

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.

rssFeed for this Thread

Contact us at files@mathworks.com