error: Value on right hand side of assignment is undefined

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

error: Value on right hand side of assignment is undefined

Mishal.Mohanlal
Hi Guys

Please refer to the below code. This is simplified case of what I am using, just to demonstrate my issue.

Once complied, the functions are available to be used in the command window.

"Function B" however does not work, as it gives the error "error: Value on right hand side of assignment is undefined"

Can someone please assist? I do not understand why the error is occurring.



Kind regards
Mishal Mohanlal
Structural Engineer
 
Weir Minerals Africa (Pty) Ltd
31 Isando Road
Isando
Johannesburg

South Africa

T + 27 (0)11 929 2908
M + 27 (0)76 680 6954
F + 27 (0)86 632 7611
mishal.mohanlal@...
weirminerals.com

global.weir
Twitter | Linkedin | Facebook
WeirLogo


CONFIDENTIAL:
The information contained in this email (including any attachments) is confidential, subject to copyright and for the use of the intended recipient only. If you are not the intended recipient please delete this message after notifying the sender. Unauthorised retention, alteration or distribution of this email is forbidden and may be actionable.
Attachments are opened at your own risk and you are advised to scan incoming email for viruses before opening any attached files. We give no guarantee that any communication is virus-free and accept no responsibility for virus contamination or other system loss or damage of any kind.



Reply | Threaded
Open this post in threaded view
|

Re: error: Value on right hand side of assignment is undefined

Doug Stewart-4


On Fri, Nov 23, 2018 at 9:44 AM <[hidden email]> wrote:
Hi Guys

Please refer to the below code. This is simplified case of what I am using, just to demonstrate my issue.

Once complied, the functions are available to be used in the command window.

"Function B" however does not work, as it gives the error "error: Value on right hand side of assignment is undefined"

Can someone please assist? I do not understand why the error is occurring.




What I see is that you have a function called B and a variable called B
This is not good!
give them different names and start again and it should work.



 
Kind regards
Mishal Mohanlal
Structural Engineer
 
Weir Minerals Africa (Pty) Ltd
31 Isando Road
Isando
Johannesburg

South Africa

T + 27 (0)11 929 2908
M + 27 (0)76 680 6954
F + 27 (0)86 632 7611
mishal.mohanlal@...
weirminerals.com

global.weir
Twitter | Linkedin | Facebook
WeirLogo


CONFIDENTIAL:
The information contained in this email (including any attachments) is confidential, subject to copyright and for the use of the intended recipient only. If you are not the intended recipient please delete this message after notifying the sender. Unauthorised retention, alteration or distribution of this email is forbidden and may be actionable.
Attachments are opened at your own risk and you are advised to scan incoming email for viruses before opening any attached files. We give no guarantee that any communication is virus-free and accept no responsibility for virus contamination or other system loss or damage of any kind.




--
DASCertificate for 206392




noname (12K) Download Attachment
noname (12K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: error: Value on right hand side of assignment is undefined

mmuetzel
In reply to this post by Mishal.Mohanlal
Your function A doesn't have a return value. Also you should use a variable
that has the same name as the function it is in. Even if it isn't a syntax
error, it might be confusing.

Try something like:

function val = A(x, y)
val = x + y;
endfunction


Markus



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: error: Value on right hand side of assignment is undefined

mmuetzel
mmuetzel wrote

> Your function A doesn't have a return value. Also you should use a
> variable
> that has the same name as the function it is in. Even if it isn't a syntax
> error, it might be confusing.
>
> Try something like:
>
> function val = A(x, y)
> val = x + y;
> endfunction
>
>
> Markus


Sorry. That should read: "... you should *not* use a variable that has the
same name as the function it is used in."

Markus




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html