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