Hi, Im trying to make the following code work and it just wont seem to do what I want. NOTE – The string length of my variable is changing so for different cases I want a different interval.
Astr = '123456789' switch Astr case strcmp(Astr([2:4,5:7]), '234567' ) x = 5 case strcmp(Astr([3:6,6:8]), '789123' ) x = 6 case strcmp(Astr([1:3,4:6]), '912345' ) x = 7 otherwise x = 8end
I think it has to do with the way Im defining the string values, it keeps outputting x = 8 (the otherwise case). Please let me know how to fix thanks!
Best Answer