help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple case function error


From: Harishkumar U
Subject: Re: Multiple case function error
Date: Thu, 2 Apr 2020 12:05:43 +0530

Thank you! I changed cross variable name. Yes, switch y block input should match the output of cross block to obtain either xpos or xneg value. But, when I use 'd' its ignoring the case statement and skipping forward. Can I use If else condition? something similar to switch case statement though 

On Thu, Apr 2, 2020 at 2:14 AM Nicholas Jankowski <address@hidden> wrote:


On Wed, Apr 1, 2020 at 1:31 PM harish3679 <address@hidden> wrote:
Hi,

I am trying to use multiple cases for a math operation using case{..,..} as
per octave reference. But unfortunately I am getting an error
'enter a value: d
enter cross value: h
error: 'xxpos' undefined near line 24 column 13
error: called from
    crossminmax at line 22 column 1'


I've had some trouble even trying to recreate your error.  

1 - did you define some values for d, etc, outside of what you showed? because if I run your script from a clean workspace i get:

enter a value: d
error: 'd' undefined near line 1 column 1
error: called from
    casetest at line 3 column 3

i notice some other things.  You use cross as a variable name, but it is the name of a function for performing a vector cross product.  so if the first switch doesn't set a value to overwrite the meaning of cross, you get an error calling the switch(cross) line. 

do you mean for your switch(y) block to match the letter input d or g?  in that case you need it to be defined as a character with quotation marks,  'd', or "d".  Of course, then it's not clear what values will be going into xpos or xxpos.

look at the help for switch with:  >> help switch





--
Harish Kumar

M: +91 9488309620, Whatsapp: +91 9944308505

E: address@hidden

A:

15/36, Ramanna Layout 2, Bharathi Park Road 2, 


Saibaba Colony, Coimbatore -641 043. Tamil Nadu, India






reply via email to

[Prev in Thread] Current Thread [Next in Thread]