help-octave
[Top][All Lists]
Advanced

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

Multiple case function error


From: harish3679
Subject: Multiple case function error
Date: Wed, 1 Apr 2020 12:31:03 -0500 (CDT)

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 dont know what is going wrong,Here is the code:



y = input('enter a value: ');
switch(y)

case d
  xpos = {d, h, m};
  xneg = {k, h, f};
  
  cross = input('enter cross value: ');
  
case g
  xxpos = {g, h, d};
  xxneg = {f, i, e};
  
  cross = input('enter cross value: ');
  
endswitch

switch(cross)

case {xpos, xxpos}
  max = d+h;
  disp(max)
  
case {xneg, xxneg}
  min = g-f;
  disp(min)
endswitch

Best,
Harish



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



reply via email to

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