Problem with the commands

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with the commands

Cheung
Hi,

I type the following commands to get the max of a and the index of that max.  My expected answer is: 
val = 15
ind = 2
But after I typed the following commands, I got an error message.  Could you please let me know how to write the commands correctly?
Thank you. 

Here are the commands I typed in Octave: 

>> a
a =

    1.00000   15.00000    2.00000    0.50000

>> [val. ind] = max (a)
parse error:

  syntax error

>>> [val. ind] = max (a)
          ^



Reply | Threaded
Open this post in threaded view
|

Re: Problem with the commands

BGreen
Try replacing the period with a comma. 

Sorry, I should have sent the first message to the mailing list as well

On Mon, Sep 9, 2019, 8:40 AM Brett Green <[hidden email]> wrote:
Try replacing the period with a comma.

- Brett Green

On Mon, Sep 9, 2019, 8:37 AM Cheung <[hidden email]> wrote:
Hi,

I type the following commands to get the max of a and the index of that max.  My expected answer is: 
val = 15
ind = 2
But after I typed the following commands, I got an error message.  Could you please let me know how to write the commands correctly?
Thank you. 

Here are the commands I typed in Octave: 

>> a
a =

    1.00000   15.00000    2.00000    0.50000

>> [val. ind] = max (a)
parse error:

  syntax error

>>> [val. ind] = max (a)
          ^




Reply | Threaded
Open this post in threaded view
|

Re: Problem with the commands

Doug Stewart-4
In reply to this post by Cheung


On Mon, Sep 9, 2019 at 8:37 AM Cheung <[hidden email]> wrote:
Hi,

I type the following commands to get the max of a and the index of that max.  My expected answer is: 
val = 15
ind = 2
But after I typed the following commands, I got an error message.  Could you please let me know how to write the commands correctly?
Thank you. 

Here are the commands I typed in Octave: 

>> a
a =

    1.00000   15.00000    2.00000    0.50000

>> [val. ind] = max (a)
parse error:

  syntax error

>>> [val. ind] = max (a)
          ^
why did you name it val.   <<<< there should not be a period there.



--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: Problem with the commands

Cheung
In reply to this post by BGreen
Thanks very much, Brett. 



On Mon, 9 Sep 2019 at 19:41, Brett Green <[hidden email]> wrote:
Try replacing the period with a comma. 

Sorry, I should have sent the first message to the mailing list as well

On Mon, Sep 9, 2019, 8:40 AM Brett Green <[hidden email]> wrote:
Try replacing the period with a comma.

- Brett Green

On Mon, Sep 9, 2019, 8:37 AM Cheung <[hidden email]> wrote:
Hi,

I type the following commands to get the max of a and the index of that max.  My expected answer is: 
val = 15
ind = 2
But after I typed the following commands, I got an error message.  Could you please let me know how to write the commands correctly?
Thank you. 

Here are the commands I typed in Octave: 

>> a
a =

    1.00000   15.00000    2.00000    0.50000

>> [val. ind] = max (a)
parse error:

  syntax error

>>> [val. ind] = max (a)
          ^




Reply | Threaded
Open this post in threaded view
|

Re: Problem with the commands

BGreen
You're welcome!

- Brett Green

On Mon, Sep 9, 2019, 9:21 AM Cheung <[hidden email]> wrote:
Thanks very much, Brett. 



On Mon, 9 Sep 2019 at 19:41, Brett Green <[hidden email]> wrote:
Try replacing the period with a comma. 

Sorry, I should have sent the first message to the mailing list as well

On Mon, Sep 9, 2019, 8:40 AM Brett Green <[hidden email]> wrote:
Try replacing the period with a comma.

- Brett Green

On Mon, Sep 9, 2019, 8:37 AM Cheung <[hidden email]> wrote:
Hi,

I type the following commands to get the max of a and the index of that max.  My expected answer is: 
val = 15
ind = 2
But after I typed the following commands, I got an error message.  Could you please let me know how to write the commands correctly?
Thank you. 

Here are the commands I typed in Octave: 

>> a
a =

    1.00000   15.00000    2.00000    0.50000

>> [val. ind] = max (a)
parse error:

  syntax error

>>> [val. ind] = max (a)
          ^